From a8be2c7c3726680ac4b5b21362a975fa12db08ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Gei=C3=9Fler?= Date: Sat, 3 Mar 2018 15:40:09 +0100 Subject: [PATCH 1/3] Add information on shutdown-support Documentation should also mention that compose takes dependency order into account for shutdown as well. https://github.com/docker/compose/pull/2679 --- compose/startup-order.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compose/startup-order.md b/compose/startup-order.md index 95a33ef829..22b58f1644 100644 --- a/compose/startup-order.md +++ b/compose/startup-order.md @@ -1,16 +1,16 @@ --- -description: How to control service startup order in Docker Compose -keywords: documentation, docs, docker, compose, startup, order -title: Control startup order in Compose +description: How to control service startup and shutdown order in Docker Compose +keywords: documentation, docs, docker, compose, startup, shutdown, order +title: Control startup and shutdown order in Compose notoc: true --- -You can control the order of service startup with the -[depends_on](compose-file.md#depends-on) option. Compose always starts +You can control the order of service startup and shutdown with the +[depends_on](compose-file.md#depends-on) option. Compose always starts and stops containers in dependency order, where dependencies are determined by `depends_on`, `links`, `volumes_from`, and `network_mode: "service:..."`. -However, Compose does not wait until a container is "ready" (whatever that means +However, for startup Compose does not wait until a container is "ready" (whatever that means for your particular application) - only until it's running. There's a good reason for this. From 67f6404740445e0e95ccc04e8c1560130d01eda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Gei=C3=9Fler?= Date: Sat, 3 Mar 2018 15:44:32 +0100 Subject: [PATCH 2/3] Add information on stop order Documentation should also mention that compose takes dependency order into account for shutdown as well. docker/compose#2679 --- compose/compose-file/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index 11e467776a..6ebe541d17 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -838,6 +838,9 @@ behaviors: - `docker-compose up SERVICE` automatically includes `SERVICE`'s dependencies. In the following example, `docker-compose up web` also creates and starts `db` and `redis`. + +- `docker-compose down` stops services in dependency order. In the following + example, `web` is stopped before `db` and `redis`. Simple example: From 11c1b1c65f480f9698c3ad2268b5a15d93b7086d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Gei=C3=9Fler?= Date: Mon, 5 Mar 2018 09:49:49 +0100 Subject: [PATCH 3/3] Use Compose stop instead of down --- compose/compose-file/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index 6ebe541d17..45067f5a8a 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -839,7 +839,7 @@ behaviors: dependencies. In the following example, `docker-compose up web` also creates and starts `db` and `redis`. -- `docker-compose down` stops services in dependency order. In the following +- `docker-compose stop` stops services in dependency order. In the following example, `web` is stopped before `db` and `redis`. Simple example: