full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

depends_on is deprecated in docker-compose v3

Open Koschi13 opened this issue 5 years ago • 9 comments

depends_on does not longer wait for the container to be "ready" instead it will wait for it to be started. To make sure a container is ready one should have a try again loop.

I experienced issues when deploying this, with the deploy script:

services.pgadmin.depends_on must be a list

I don't know why nobody else had this problem, but for me everything works fine when removing the depends_on lines. This seems to be the expected behavior as stated in the docs:

There are several things to be aware of when using depends_on:

  • depends_on does not wait for db and redis to be “ready” before starting web - only until they have been started. If you need to wait for a service to be ready, see Controlling startup order for more on this problem and strategies for solving it.
  • Version 3 no longer supports the condition form of depends_on.
  • The depends_on option is ignored when deploying a stack in swarm mode with a version 3 Compose file.

Did someone else had this problem? Is it save to remove the depends_on lines?

Koschi13 avatar Sep 21 '20 06:09 Koschi13

i just got this issue a few minitus ago, how to fix it ?

services.backend.depends_on must be a list

jackleeforce avatar Sep 21 '20 08:09 jackleeforce

i just got this issue a few minitus ago, how to fix it ?

services.backend.depends_on must be a list

You have to delete all depends_on in your docker-compose.yml. As far as I know the are not mandatory for running :)

Koschi13 avatar Sep 21 '20 08:09 Koschi13

using dc 3.7 and is working fine here. was not able to reproduce with 3.3 either.

haviduck avatar Sep 21 '20 23:09 haviduck

ok, what are your versions, mine are:

  • docker: Docker version 19.03.12, build 48a66213fe
  • docker-compose: docker-compose version 1.27.3, build unknown
  • system: Linux 4.15.0-117-generic #118-Ubuntu SMP Fri Sep 4 20:02:41 UTC 2020

Koschi13 avatar Sep 22 '20 05:09 Koschi13

i just got this issue a few minitus ago, how to fix it ?

services.backend.depends_on must be a list

You have to delete all depends_on in your docker-compose.yml. As far as I know the are not mandatory for running :)

thanks,it works fine for me:)

jackleeforce avatar Sep 23 '20 03:09 jackleeforce

Same problem here. Running on a mac, versions for reference:

Docker:

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:07:04 2020
  OS/Arch:          linux/amd64
  Experimental:     true

Docker Compose:

docker-compose version 1.27.4, build 40524192

Removing depends_on works around the issue for me too.

kmatarese avatar Oct 01 '20 16:10 kmatarese

Long syntax does not not seems deprecated according to latest docker compose specification but clearly not implemented with docker stack for me either. Only the short syntax is working.

mulder999 avatar May 15 '22 08:05 mulder999

following as docker stack seems to be missing Long syntax indeed

Ren22 avatar Jun 08 '22 13:06 Ren22

The depends_on option is ignored when deploying a stack in swarm mode with a version 3 Compose file.

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

diegobill avatar Feb 10 '23 16:02 diegobill