How to auto restart a Docker container after a reboot in CoreOS?

Richard picture Richard · Sep 13, 2013 · Viewed 28.1k times · Source

Assuming the Docker daemon is restarted automatically by whatever init.d or systemd like process when the OS is restarted, what is the preferred way to restart one or more Docker containers? For example I might have a number of web servers behind a reverse proxy or a database server.

Answer

creack picture creack · Sep 14, 2013

if you start the daemon with docker -d -r, it will restart all containers that were running prior the daemon stopped. This will become the default behavior in the next release.