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
1,123 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,980 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 23, 2019 in Docker by Kalgi
• 52,350 points
2,214 views
0 votes
1 answer
0 votes
1 answer

With docker compose, which parameter should I use to run a yaml file ?

Yep. Wrong command. $ docker-compose build And then run ...READ MORE

answered Oct 27, 2020 in Docker by Justin
752 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
• 58,020 points
2,706 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,980 points
1,033 views
+1 vote
2 answers

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

Here is a way which you can ...READ MORE

answered Aug 28, 2018 in Docker by Damon Salvatore
• 5,980 points
28,569 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP