Day-3: Connecting Docker Containers (Module-3- Docker Zero To Hero Bangla Course)


   Create a Common Network for PHP & MySQL container

  1.  docker network create chatbot

    PHP Container

  1.  At first clone this repo
  2. Then go to the folder. Change the host name from localhost to db and add password 1test2 in config.php
  3. Build the image 
  4.  docker build -t chatbotimage .
  5.  Finally Run the Image
  6.  docker run -d -p 5400:80 --name chatbotapp --network chatbot chatbotimage

    MySQL Container

       Pull mysql image and then Run

  1. docker pull mysql

  2. docker run -d -p 3306:3306 --name db --network chatbot -e MYSQL_ROOT_PASSWORD=1test2 -e MYSQL_DATABASE=chat mysql


    Exec into mysql container


    docker exec -it db bash


    Login to mysql and database


    mysql -u root -p


    use chat;


    Run the sql commands from the database/chat.sql to create user & 

    insert data


    Go to http://localhost:5400  



    Video tutorial







Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment


Post a Comment