Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose (version 3): depends_on contains an invalid type, it should be an array #30404

Closed
royeectu opened this issue Jan 24, 2017 · 18 comments

Comments

@royeectu
Copy link

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"
@cpuguy83
Copy link
Member

ping @dnephin

@thaJeztah
Copy link
Member

@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 ?

@dnephin
Copy link
Member

dnephin commented Jan 24, 2017

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.

@arvenil
Copy link

arvenil commented Mar 12, 2017

@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?

@dnephin
Copy link
Member

dnephin commented Mar 13, 2017

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

@bentrility
Copy link

Anybody know if there is a recommended replacement that should be used? Thank you

@dimitriy-k
Copy link

any depends_on "condition: service_healthy" check in v.3 so far?

@storytime
Copy link

any news ?

@MartinCerny-awin
Copy link

MartinCerny-awin commented Aug 17, 2017

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

ben181231 added a commit to ALSAD-project/smoke-test that referenced this issue Apr 12, 2018
P.S. This is ignored when using `docker stack deploy`.
     [See Here](moby/moby#30404 (comment))
ben181231 added a commit to ALSAD-project/alsad-core that referenced this issue Apr 12, 2018
P.S. This is ignored when using `docker stack deploy`.
     [See Here](moby/moby#30404 (comment))
@lifenautjoe
Copy link

How is dropping support altogether an improvement? Can anyone point me out to the discussion where the decision was made?

@thaJeztah
Copy link
Member

@lifenautjoe see the discussion on #31333 (and #31333 (comment)). For docker-compose (not docker stack deploy), I also left a suggestion in #31333 (comment) (have a x-depends_on)

fadenb pushed a commit to fadenb/parsedmarc-dockerized that referenced this issue Dec 1, 2019
This requires docker-compose file format 2.4 as the condition is no longer supported in the newer versions.
See moby/moby#30404 (comment)
@Strandedpirate
Copy link

Every time i need to do something in docker-compose -> feature removed -> not doing -> response intentionally left blank -> 5 years later...

@OneCricketeer
Copy link

@Strandedpirate New features are going towards http://compose-spec.io

hvvka added a commit to hvvka/wielki-sniffer that referenced this issue May 13, 2020
Q&A: Why is docker compose version downgraded?
In v3 depends_on is not supported.
moby/moby#30404 (comment)
@JustusNBB
Copy link

I can still use the condition with version 3.7, so you don't need to downgrade guys...

@Jood80
Copy link

Jood80 commented Mar 17, 2021

@JustusNBB have you changed the syntax from the one mentioned in the documentation?

@JustusNBB
Copy link

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!

@robertlagrant
Copy link

@Strandedpirate New features are going towards http://compose-spec.io

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.
image

@moxched
Copy link

moxched commented May 28, 2023

it looks like when using docker-compose the issue arises, i've tried with docker compose and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests