0

How do you "tell" the docker-compose to delay before starting the container?

The container is already up and the service is not ready yet. Docker does not take into account the readiness of the service (the container is raised) and it starts the next one. The next one looks at the availability of the service and it is not there yet - it falls.

  • 2
    Did you make a [depends_on](https://docs.docker.com/compose/startup-order/) script? – DerMaddi Mar 01 '21 at 11:43
  • A quick thought... maybe you can do something like `docker run sleep 1000 && yourCommand`. – Kit Mar 01 '21 at 11:55
  • No, i try add "Health Check", but i don't understand how to check. The developers refer to wait for it, but with it it gets in the wrong place. We do not have such IP. Сurl is missing, telnet is available Seems to have written, but the process hangs when trying to check – Arthur Shchekaturov Mar 01 '21 at 12:01
  • Generally you need to include something in the container startup; use something like an entrypoint wrapper script to wait for the dependency to be ready, and then run the main command. The linked question has details. An alternative is to set the container to `restart: unless-stopped` and just let it restart until the dependency is ready (this is what you'd generally do in Kubernetes). – David Maze Mar 01 '21 at 13:28
  • I figured it out, everything worked out, thank you all for your responsiveness! – Arthur Shchekaturov Mar 01 '21 at 13:46

0 Answers0