Docker Compose with one Terminating Container

I’m having a docker compose setup of a database container, an application container and one container which pre-loads the database with necessary data.

I want to start all of the containers together with docker-compose up while the pre-loading container terminates after it is one with exit 0.

  • IBM Bluemix: Not able to mount the MongoDB container “/data/db” on the Bluemix host volume
  • Shortcut for deleting docker image and all containers using it?
  • Docker stops working inside Vagrant When I Update Guest Additions
  • Populate cassandra after Docker-compose finishes
  • Spring boot docker plugin requires removing the image everytime
  • “Plugging in” Docker Container to Host Network
  • But terminating this one container takes down the complete setup with the message:

    composesetup_load_1 exited with code 0
    Gracefully stopping... (press Ctrl+C again to force)
    Stopping composesetup_app_1...
    Stopping composesetup_db_1...

    Is there any way of having multiple containers with different life-time in one docker-compose setup? If yes, how?

  • Docker mysql mounted logs directory always empty
  • How to fix this issue “no suitable node (scheduling constraints not satisfied on 1 node)” in docker swarm while deploying registry?
  • Docker API - how do I join a network?
  • Allow Docker to cache RUN results
  • Unable to download docker golang image: No command specified
  • Pull private docker images from Google Container Registry w/o gcloud
  • One Solution collect form web for “Docker Compose with one Terminating Container”

    My workaround for now is to keep the pre-loading container running by adding tail -f /dev/null to the end of the entrypoint script. This keeps the process running, while nothing actual happens.

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