Docker: Automatically Restarting Containers

As a Docker beginner, I always wondered, how to automatically restart container os or system boot?

Thankfully, Docker 1.2 introduced restart policies (which makes sure even linked containers are started in expected order).  The --restart=always flag/value can be passed to ensure automatic restart of containers.

docker run --restart=always redis

Read more about Docker Restart Policies, or other methods.