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)

Commits related to this issue

Most upvoted comments

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

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

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?

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

any news ?

@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

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…