From d90cd01fab40be44b8a345a89e602505b6c125e5 Mon Sep 17 00:00:00 2001 From: Baptiste TAVIOT <30879857+TaviotBaptiste@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:02:59 +0100 Subject: [PATCH] Update 101-docker-compose.md update : add depends_on --- .../content/108-running-containers/101-docker-compose.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data/roadmaps/docker/content/108-running-containers/101-docker-compose.md b/src/data/roadmaps/docker/content/108-running-containers/101-docker-compose.md index 5c5969134..dfac67e20 100644 --- a/src/data/roadmaps/docker/content/108-running-containers/101-docker-compose.md +++ b/src/data/roadmaps/docker/content/108-running-containers/101-docker-compose.md @@ -21,13 +21,15 @@ services: image: nginx:latest ports: - "80:80" + depends_on: + - db db: image: mysql:latest environment: MYSQL_ROOT_PASSWORD: mysecretpassword ``` -In this example, we have specified two services: a web server (`web`) running the latest version of the nginx image, and a database server (`db`) running MySQL. The web server exposes its port 80 to the host machine, and the database server has an environment variable set for the root password. +In this example, we have specified two services: a web server (`web`) running the latest version of the nginx image, and a database server (`db`) running MySQL. The web server exposes its port 80 to the host machine and depends on the launch of the database (`db`). The database server has an environment variable set for the root password. ## Running Docker Compose: @@ -46,4 +48,4 @@ Docker Compose will read the file and start the defined services in the specifie - `docker-compose logs`: Displays the logs of all containers defined in the `docker-compose.yml` file. - `docker-compose build`: Builds all images defined in the `docker-compose.yml` file. -That's a brief introduction to Docker Compose! For more information, check out the official [Docker Compose documentation](https://docs.docker.com/compose/). \ No newline at end of file +That's a brief introduction to Docker Compose! For more information, check out the official [Docker Compose documentation](https://docs.docker.com/compose/).