diff --git a/docs/dockercompose.md b/docs/dockercompose.md index 469354c..cb7e562 100644 --- a/docs/dockercompose.md +++ b/docs/dockercompose.md @@ -64,17 +64,18 @@ services: image: nginx ports: - "80:80" - database: image: mysql environment: MYSQL_ROOT_PASSWORD: password + ports: + - "3306:3306" ``` - `services`: This section defines the different services (containers) that will be part of our multi-container application. - `webserver`: This service uses the latest version of the Nginx image available on Docker Hub. The `ports` section maps the host's port 80 to the container's port 80, allowing access to the web server from the host machine. - - `database`: This service uses the latest version of the MySQL image available on Docker Hub. The `environment` section sets up environment variables for the MySQL database, in this case the root password. + - `database`: This service uses the latest version of the MySQL image available on Docker Hub. The `environment` section sets up environment variables for the MySQL database, in this case the root password and the`ports` section maps the host's port 3306 to the container's port 3306. **Step 4: Check the validity of a Docker Compose file** @@ -141,7 +142,7 @@ docker-compose ps ``` In this case, we can further verify that the Nginx server is up and running by opening our web browser and navigating to http://localhost:80. -We can also login to MySQL using the following command: +We can also login to MySQL using the following command: or you can use tools such as phpMyadmin or MySQL Workbench. ```bash docker exec -it your_container_id mysql -u root -p @@ -159,7 +160,7 @@ Create a new directory and create the following files inside it: **Dockerfile**: Custom Dockerfile to build the Apache image. -**index.php**: A simple PHP file to test the web application. You can copy the following code and save it as ```index.php```. +**index.php**: A simple PHP file to test the web application. You can create a folder named **public**, copy the following code and save it as ```index.php```. ```php