moby: docker-compose (version 3): depends_on contains an invalid type, it should be an array
Description
Steps to reproduce the issue: 1.Verify that docker-compose 1.10.0 is installed (docker-compose --version) 2. Verify that you are using version 3 file format 3. Validate and view the compose file (docker-compose -f test.yml config)
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"
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (5 by maintainers)
Links to this issue
Commits related to this issue
- Add service dependency for FaaS deployment P.S. This is ignored when using `docker stack deploy`. [See Here](https://github.com/moby/moby/issues/30404#issuecomment-274825244) — committed to ALSAD-project/smoke-test by ben181231 6 years ago
- Add service dependency for FaaS deployment P.S. This is ignored when using `docker stack deploy`. [See Here](https://github.com/moby/moby/issues/30404#issuecomment-274825244) — committed to ALSAD-project/alsad-core by ben181231 6 years ago
- Wait until elasticsearch is "healthy" before starting other containers This requires docker-compose file format 2.4 as the condition is no longer supported in the newer versions. See https://github.c... — committed to fadenb/parsedmarc-dockerized by deleted user 5 years ago
- Add elasticsearch healthcheck to docker-compose Q&A: Why is docker compose version downgraded? In v3 depends_on is not supported. https://github.com/moby/moby/issues/30404#issuecomment-323212621 — committed to hvvka/wielki-sniffer by hvvka 4 years ago
- fix: use docker-compose v 2.1 instead of 3 to bypass " depends_on contains an invalid type, it should be an array" exception as discussed in issue https://github.com/moby/moby/issues/30404 — committed to fpaupier/gRPC-multiprocessing by fpaupier 3 years ago
Here is description how to use it in version 3 https://docs.docker.com/compose/compose-file/#depends_on
Condition is not supported anymore
Every time i need to do something in docker-compose -> feature removed -> not doing -> response intentionally left blank -> 5 years later…
any depends_on “condition: service_healthy” check in v.3 so far?
Anybody know if there is a recommended replacement that should be used? Thank you
@dnephin
https://docs.docker.com/compose/compose-file/#dependson
The doc at the top states
Compose file version 3 reference
yet it has examplewhile the example says at the top
version 2.1
I understand it asyou 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?How is dropping support altogether an improvement? Can anyone point me out to the discussion where the decision was made?
any news ?
This is more confusing! According to that site, the spec is on Github, and the relevant section is here: https://github.com/compose-spec/compose-spec/blob/master/spec.md#long-syntax-1 - which does have depends_on constraints.
E.g.
For some reason it worked on my OSX machine, but then broke on Jenkins. I added a wait loop to my entrypoint now as an alternative solution, dockerize is also recommended!
it looks like when using docker-compose the issue arises, i’ve tried with docker compose and it worked
I can still use the
condition
with version 3.7, so you don’t need to downgrade guys…