Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Docker stack deploy healthcheck in V3 docker-compose.yml not working in CoreOS Alpha 1339.0.0 #1848

Closed
pmualaba opened this issue Mar 6, 2017 · 10 comments

Comments

@pmualaba
Copy link

pmualaba commented Mar 6, 2017

Issue Report

Bug

The following command works perfectly in CoreOS Alpha 1325.1.0 but it does not work anymore in CoreOS Alpha 1339.0.0

On executing the following command in the latest CoreOS Alpha 1339.0.0 I now receive the following error:

**.depends_on must be a list**

$ docker stack deploy neo4j-test --compose-file=./docker-compose.yml

version: '3'

services:

  neo4j-999-601-test:
    image: neo4j:3.1.1
    ports:
      - "7474:7474"
      - "7687:7687"
    networks:
      - neo4j-test
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://neo4j-999-601-test:7474 && echo 'OK'"]
      interval: 5s
      timeout: 2s
      retries: 3

... in other container ... ;

    depends_on:
      neo4j-999-601-test:
        condition: service_healty

V3 supports docker healthcheck condition parameter for depends_on directive. It seems that docker-compose.yml Version '3' format is not parsed correctly anymore?

Container Linux Version

Alpha 1339.0.0

$ cat /etc/os-release
NAME="Container Linux by CoreOS"
...
BUG_REPORT_URL="https://github.com/coreos/bugs/issues"

Environment

What hardware/cloud provider/hypervisor is being used to run Container Linux?

Expected Behavior

healtcheck and depends_on condition used in V3 docker-compose.yml file should not give error

**.depends_on must be a list**

when executing docker stack deploy in swarm mode.

Actual Behavior

Reproduction Steps

  1. ...
  2. ...

Other Information

Feature Request

Environment

What hardware/cloud provider/hypervisor is being used to run Container Linux?

Desired Feature

Other Information

@crawford
Copy link
Contributor

crawford commented Mar 7, 2017

It looks like docker is complaining that the depends_on option you provided isn't a list (maybe they changed that recently). I think you actually want to use something like this:

    depends_on:
      - neo4j-999-601-test:
          condition: service_healty [sic]

@pmualaba
Copy link
Author

pmualaba commented Mar 7, 2017

Indeed, before docker healthchecks were supported (docker pre 1.12), depends_on only accepted a list, but now it accepts a map to support the healtcheck condition (as per docker 1.13 healtcheck specification). This worked perfectly in Alpha 1325.1.0 but is broken in latest Alpha 1339.0.0

@crawford : the code above will also break with error: .depends_on.0 must be a string

The correct syntax for depends_on healtcheck condition is:

 depends_on:
     neo4j-999-601-test:
         condition: service_healty

and works in Alpha 1325.1.0 but is broken in Alpha 1339.0.0

@lucab
Copy link

lucab commented Mar 7, 2017

It looks like Docker had several planned changes recently regarding depends_on, and possibly different semantics between docker-compose and docker stack, see docker/compose#4305 for all the details.

@pmualaba as this looks like an upstream bug, I suggest you to report it directly to the docker/docker bug-tracker for better insights.

@bgilbert
Copy link
Contributor

Closing due to inactivity.

@lloiacono
Copy link

According to docker-compose documentation:

Version 3 no longer supports the condition form of depends_on.

https://docs.docker.com/compose/compose-file/#depends_on

@BelfordZ
Copy link

@lloiacono any idea what we can do instead? (other than the wait-for-it script before the containers CMD)

@doruchiulan
Copy link

Any update for BelfordZ question? wait-for-it script seems like a workaround and not the right way to do it

@d00m178
Copy link

d00m178 commented Jul 3, 2018

Any updates on this?

@JustinMascotto
Copy link

the previous implementation seemed more intuitive. Is there any intention on bringing this functionality back?

@evanilukhin
Copy link

evanilukhin commented Sep 27, 2018

I'm totally agree with @JustinMascotto but I found the good explanation why did they do it peter-evans/docker-compose-healthcheck#3 (comment).

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

No branches or pull requests

10 participants