Tangible Bytes

A Web Developer’s Blog

Set Containers to Start on Boot

If you are running services via docker, how do you make sure they start up after a reboot, after restarting the docker daemon, or just after they crash?

Read this page Start containers automatically

If you know when you first run the container that you want this

docker run -d --restart unless-stopped myimage

If you want to change an existing conatiner

docker update --restart unless-stopped mycontainer

To check the policy of a running container

Use docker inspect - and optionally the jq utility top parse the JSON

docker inspect mycontainer | jq -r '.[] | .HostConfig.RestartPolicy '