Docker Community Forums

Share and learn in the Docker community.

Restarting containers after reboot


(Michael Brown) #1

We have the problem that our containers don’t restart after a reboot. Adapting the cleanup command to our needs here, we’re able to restart all containers that stopped less than 10 minutes ago:

docker inspect -f '{{.Id}},{{.State.Running}},{{.State.FinishedAt}}' $(docker ps -qa) | \
  awk -F, '$2=="false" && $3 > strftime("%FT%T.000000000Z",systime()-60*10) {print $1;}' | \
  xargs -n1 docker start

Container not restarted after reboot
(Andy Rothfusz) #2

Is there anything in the docker log that indicates a problem during the shutdown, prior to reboot?


(Sam Saffron) #3

We should look at restart policies in 1.2.0 they may solve this.