2

I'm launching my apps on Docker swarm. some of my apps have to wait for others. Since my applications do not have any health checks, I have to do this via docker swarm. My applications are not directly dependent on each other so my services start but run incorrectly. Because my other applications that need to start are not actually standing. An alternative to depends_on is a health check for containers to wait for each other for swarm, or What can I do for swarm, such as determining the order in which containers are created.

  • https://docs.docker.com/compose/startup-order/ – Hans Kilian Dec 06 '21 at 09:06
  • @HansKilian First of all, thank you for your comment. I already use this method for compose. I haven't found a way for Swarm yet. – sercanezelhan Dec 06 '21 at 11:43
  • Do the approaches in [Docker Compose wait for container X before starting Y](https://stackoverflow.com/questions/31746182/docker-compose-wait-for-container-x-before-starting-y) work for you? In addition to Docker health checks, the two other major approaches (both described in that question) are using a script in the container startup to wait for the dependency, and just having the container exit immediately if the dependency isn't available but having Docker restart it for you. – David Maze Dec 06 '21 at 11:44
  • @DavidMaze Thank you. Restarting solves the problem but I have multiple servers and I have to automate this situation by waiting. – sercanezelhan Dec 06 '21 at 11:56
  • @SercanEzelhan I haven't worked much with swarm, so I thought the same approach would work there (i.e. have the containers wait until their dependencies are ready). – Hans Kilian Dec 06 '21 at 12:00

0 Answers0