Method 1 (For Better Understanding):
Create a Common Network for PHP & MySQL container
- docker network create chatbot
PHP Container
- At first clone this repo https://github.com/shawon100/RUET-ChatBot
- Then go to the folder. Change the host name from localhost to db and add password 1test2 in config.php
- Build the image
- docker build -t chatbotimage
- Finally Run the Image
- docker run -d -p 5400:80 --name chatbotapp --network chatbot chatbotimage
MySQL Container
Pull mysql image and then Run
docker pull mysql:latest
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 chat.sql from the database folder to Insert the data
Go to http://localhost:5400
If you want to become a master in Docker for handling production grade workloads you can enroll in this course.
Method 2 (Using Docker Compose):
- At first clone this repo https://github.com/shawon100/RUET-ChatBot
- Then go to the folder. Change the host name from localhost to db and add password 1test2 in config.php
- Then run the docker-compose.yml using this command:
- docker-compose up -d
Video Tutorial
This comment has been removed by the author.
ReplyDelete