mirror of https://github.com/docker/docs.git
Fix depends_on in Compose file v3 reference (#2278)
* docker swarm does not respect depends_on Swarmkit does not seem to have the concept of starting services in a particular order. Tested with docker 1.13.1. Also, `docker-compose bundle` warns us about depends_on being unsupported. * Remove condition form of depends_on from the V3 compose file docs. Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
8481cacd3e
commit
37333c8fe8
|
|
@ -343,38 +343,19 @@ Simple example:
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
|
|
||||||
> **Note:** `depends_on` will not wait for `db` and `redis` to be "ready" before
|
> **Note:** There are several things to be aware of when using `depends_on`:
|
||||||
> starting `web` - only until they have been started. If you need to wait
|
>
|
||||||
> for a service to be ready, see [Controlling startup order](/compose/startup-order.md)
|
> - `depends_on` will not wait for `db` and `redis` to be "ready" before
|
||||||
> for more on this problem and strategies for solving it.
|
> starting `web` - only until they have been started. If you need to wait
|
||||||
|
> for a service to be ready, see [Controlling startup order](/compose/startup-order.md)
|
||||||
|
> for more on this problem and strategies for solving it.
|
||||||
|
>
|
||||||
|
> - Version 3 no longer supports the `condition` form of `depends_on`.
|
||||||
|
>
|
||||||
|
> - The `depends_on` option is ignored when
|
||||||
|
> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md)
|
||||||
|
> with a version 3 Compose file.
|
||||||
|
|
||||||
A healthcheck indicates you want a dependency to wait
|
|
||||||
for another container to be "healthy" (i.e. its healthcheck advertises a
|
|
||||||
successful state) before starting.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
version: '2.1'
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
build: .
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
redis:
|
|
||||||
condition: service_started
|
|
||||||
redis:
|
|
||||||
image: redis
|
|
||||||
db:
|
|
||||||
image: redis
|
|
||||||
healthcheck:
|
|
||||||
test: "exit 0"
|
|
||||||
|
|
||||||
In the above example, Compose will wait for the `redis` service to be started
|
|
||||||
(legacy behavior) and the `db` service to be healthy before starting `web`.
|
|
||||||
|
|
||||||
See the [healthcheck section](#healthcheck) for complementary
|
|
||||||
information.
|
|
||||||
|
|
||||||
### dns
|
### dns
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue