Efficient way to run a Docker Compose stack in production?

0 votes

I have having some compose files describing a simple Django application which consists of three images and five containers.

What I want is to run this stack in production - to have the whole stack begin on boot, and for containers to restart or be recreated if they crash. There aren't any volumes I care about and the containers won't hold any important state and can be recycled at will.

I am thinking to just put restart: always on all my services and make an init script to do docker-compose up -d on boot.

Is there a recommended way to manage a docker-compose stack in production in a robust way?

Can anyone help me with this query ?

Thanks

Aug 2, 2018 in Docker by Atul
• 10,240 points
241 views

1 answer to this question.

0 votes

Here is a concept which you can follow.Since compose is a client tool, but when you run 

docker-compose up -d, all the container options are sent to the Engine and stored. If you specify restart as always (or preferably unless-stopped to give you more flexibility) then you don't need run docker-compose up every time your host boots.

When the host starts, provided you have configured the Docker daemon to start on boot, Docker will start all the containers that are flagged to be restarted. So you only need to run docker-compose up -d once and Docker takes care of the rest.

I hope the above information will resolve your query.

answered Aug 2, 2018 by Damon Salvatore
• 5,550 points

Related Questions In Docker

0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 22, 2019 in Docker by Kalgi
• 51,950 points
314 views
0 votes
1 answer
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,100 points
1,261 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,640 points
775 views
+1 vote
1 answer

How to deploy a java app to Docker?

If you are having JAR file, the quickest ...READ MORE

answered Aug 2, 2018 in Docker by Damon Salvatore
• 5,550 points
119 views
0 votes
2 answers

How do I copy a file from docker container to host?

Instead of using docker run you could ...READ MORE

answered Aug 13, 2019 in Docker by Sirajul
• 57,890 points
19,295 views