Define & run a simple, multi-container web application using docker-compose
- Install Docker
- $ git clone https://github.com/Lily-G1/Docker-Compose-to-Deploy-Web-App.git
- $ cd Docker-Compose-to-Deploy-Web-App/web-app/
- $ docker compose build
- $ docker compose up -d
- Check browser with IP address or localhost:80. To test the app, fill form & submit
To confirm that our app is connected to the backend, view the database to check for successful data entries:
- $ docker ps
- $ docker exec -it 'mysql container ID' /bin/bash
- #mysql -u root -p (enter mysql password)
- mysql> use db;
- mysql> select * from test; --> to view table & confirm that form data has been entered successfully
- exit; --> to exit mysql
- #exit --> to exit container
- $ docker compose down --> stops & removes containers, images, volumes, etc created by 'docker compose up -d'
- To use a different password for MySQL, change passwords in mysql/Dockerfile and change the value of $password in form_submit.php to new password
- The MySQL database schema was created from the template of a mysql dump. This can be found in mysql/db.sql