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.

  • find docker containers created using a docker image
  • Dockerfile CMD not accepting variables
  • Installing tensorflow through docker on Ubuntu 14.04
  • How can I ssh into “Web App On Linux” docker container on Azure?
  • How do I run a python script with Tensorflow running in a Docker on Windows?
  • Gitlab CI with Ionic2 and dockerfile for generating apk
  • 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.

  • how to read files from a python module inside docker
  • Using Docker I get the error: “SQLSTATE[HY000] [2002] No such file or directory”
  • dumb-init No such file or directory
  • Unable to enter Docker container on remote Linux box with procedure that works fine on local box?
  • Vagrant box and Docker provider: Titan and Kafka
  • Deploy a Dockerized Symfony2 application on AWS Elastic Beanstalk
  • 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.