Select Page

How to auto-restart Docker containers after a host server crash

How to auto-restart Docker containers after a host server crash

Docker containers can be used to host applications ranging from one-time testing to 24/7 web hosting instances. Depending on its purpose, the system setup can vary.

Every Docker machine runs a ‘docker’ daemon, which is required for the containers to function. But during instances such as server crash or reboot, this daemon may not get restarted.

Today we’ll see what is Docker restart policy and how to auto-restart Docker containers to ensure that there is no service downtime.

Setup and manage your Docker system

GET IN TOUCH WITH THE DOCKER EXPERTS NOW!

What is Docker restart policy?

To ensure that the Docker daemon gets restarted after a host machine restart, you can enable the docker service to start in machine boot.

But that’s not enough to guarantee your business uptime. Because, by default, the Docker containers will not restart when the docker daemon is restarted.

As a result, even if the host machine or the docker service restarts, the containers in it would be non-functional. This would cause downtime for the businesses hosted in them.

For services that require high uptime, such as website hosting, it is therefore important to auto-restart Docker containers after restarting the docker daemon.

This can be now set using the Docker restart policy. A restart policy controls whether the Docker daemon restarts a container after exit.

Using the restart policy, when the docker daemon restarts, the containers will be restarted too. The default policy is ‘no’, as we discussed.

Docker supports the following restart policies for its containers and can be set during container start:

auto-restart docker containers

Container restart policies


Disk space issues in Docker ?

Wish you had more time to focus on your business? Let us help you.

Our engineers will assist you to setup, monitor and manage your Docker infrastructure 24/7.

GET IN TOUCH WITH THE EXPERTS NOW!




Bobcares provides Outsourced Hosting Support and Outsourced Server Management for online businesses. Our services include Hosting Support Services, server support, help desk support, live chat support and phone support.

Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES