Description
Steps to reproduce the issue:
1.Verify that docker-compose 1.10.0 is installed (docker-compose --version)
Describe the results you received:
I got the following error message: ERROR: The Compose file './test.yml' is invalid because:
services.web.depends_on contains an invalid type, it should be an array
Describe the results you expected:
I should get the content of the yml file
Additional information you deem important (e.g. issue happens only occasionally):
If you change the version to: 2.1 it works. The problem only occurs with version: 3
Output of docker version
:
Client:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Wed Jan 18 16:20:26 2017
OS/Arch: darwin/amd64
Server:
Version: 1.13.0
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 49bf474
Built: Wed Jan 18 16:20:26 2017
OS/Arch: linux/amd64
Experimental: true
docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
Output of docker info
:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 23
Server Version: 1.13.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.4-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952 GiB
Name: moby
ID: AYXL:LFCG:OTTZ:BU52:F6MK:ECNA:42QF:MUJU:4NES:AT5D:UWRK:YWVV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 26
System Time: 2017-01-24T13:47:58.459866975Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Username: royeectu
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
The content of the test.yml file:
version: '3'
services:
web:
build: .
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
redis:
image: redis
db:
image: redis
healthcheck:
test: "exit 0"
ping @dnephin
@royeectu It looks like this error is when using docker-compose
; can you reopen this issue in the docker-compose issue tracker? https://github.com/docker/compose/issues ?
I think this is the correct behaviour. The extended depends field was only added to the v2.1 format.
depends_on
is a no-op when used with docker stack deploy
. Swarm mode services are restarted when they fail, so there's no reason to delay their startup. Even if they fail a few times, they will eventually recover.
@dnephin
I think this is the correct behaviour. The extended depends field was only added to the v2.1 format.
https://docs.docker.com/compose/compose-file/#dependson
The doc at the top states Compose file version 3 reference
yet it has 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"
while the example says at the top version 2.1
I understand it as you need to have at least version 2.1
. The doc doesn't say this is not anymore supported in 3.0. Maybe either add this info or remove extended example as I understand this is not gonna be supported in future versions anyway?
Thanks, yes we need to fix the docs here. We recently split the docs by version, and it seems we missed that during the split.
I opened #2278
Anybody know if there is a recommended replacement that should be used? Thank you
any depends_on "condition: service_healthy" check in v.3 so far?
any news ?
Here is description how to use it in version 3 https://docs.docker.com/compose/compose-file/#depends_on
version: '3'
services:
web:
build: .
depends_on:
- db
- redis
redis:
image: redis
db:
image: postgres
Condition is not supported anymore
How is dropping support altogether an improvement? Can anyone point me out to the discussion where the decision was made?
@lifenautjoe see the discussion on https://github.com/moby/moby/issues/31333 (and https://github.com/moby/moby/issues/31333#issuecomment-409143581). For docker-compose (not docker stack deploy
), I also left a suggestion in https://github.com/moby/moby/issues/31333#issuecomment-333265696 (have a x-depends_on
)
Every time i need to do something in docker-compose -> feature removed -> not doing -> response intentionally left blank -> 5 years later...
@Strandedpirate New features are going towards http://compose-spec.io
Most helpful comment
any depends_on "condition: service_healthy" check in v.3 so far?