How could one use Docker Compose to synchronize container execution?

How could one use Docker Compose to synchronize container execution?

The problem I’m trying to solve is similar to Docker Compose wait for container X before starting Y. I use Docker Compose to launch several containers, all running on the same host, three of which are PostgreSQL, Liquibase, and a Web application servlet running in Tomcat. The PostgreSQL and Web application containers are both long running while the Liquibase container is ephemeral. The containers must not only start in order, but each container must also wait for the preceding container to be available or complete. In particular, the PostgreSQL server must be ready to process SQL commands before the Liquibase container runs, and the Liquibase schema migration task must complete before the Web application starts to ensure that the database schema is in a valid state.

  • run vlc in a Docker image to send a video stream via rtsp protocol
  • Connecting php docker to mqtt docker
  • renaming docker0 virtual bridge name to something else
  • Why am i forced to run docker with sudo on OS X?
  • How to create a copy of exisiting docker image
  • Docker Commit Created Images and ENTRYPOINT
  • I understand that I can achieve this synchronization using two wrapper “wait-for” scripts that poll for certain conditions (and this may be the only available option), the first of which would poll the availability of the PostgreSQL server to process commands while the second, which would run just prior to the Web application, could poll for the presence of a particular database object. However, like process synchronization, I think container synchronization is a common problem that can be addressed with more general inter-process communication and synchronization primitives like semaphores. Docker Compose would likely benefit the most from such synchronization mechanisms, but Docker containers might find them useful, too, for example, to establish multiple synchronization points within a container.

  • Access logs of a killed docker container
  • add hosts redirection in docker
  • Starting mongo through docker on a Synology NAS
  • I need to run many apache2.0 servers on different docker container and give each one port number
  • Cant delete Docker image
  • Trouble developing on mirrored, but separate, production environment
  • 3 Solutions collect form web for “How could one use Docker Compose to synchronize container execution?”

    Until Docker Compose or Docker supports container synchronization primitives (similar to process synchronization primitives, but accessible from the shell), Dependencies for docker-compose with inotify is one of the better solutions that I’ve found to the Docker Compose container synchronization problem.

    In addition to consul, etcd, and ZooKeeper, MQTT retained messages are another simple mechanism that Docker containers might use to coordinate activities. Mosquito is a lightweight, open-source implementation of MQTT.

    I’ve come to the conclusion that Docker Compose is not the most appropriate tool for container synchronization. Tools like Kubernetes or Marathon facilitate more sophisticated container synchronization. What is the best Docker Linux Container orchestration tool? compares available container synchronization tools.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.