简体   繁体   中英

restart docker containers after reboot

I have been trying to make docker containers restart after reboot. I am using --restart unless-stopped option. Container starts after reboot but I have to be logged in to my remote machine. I am running docker on my remote machine.

docker run --restart unless-stopped -d -v /var/run/docker.sock:/var/run/docker.sock --net sp-example-net -p 8080:8080 sp

Docker has restart policies such as --restart=always that will handle this. This is also available in the compose.yml config file as restart: always.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM