Docker

[Docker] 재부팅 시 컨테이너 다시 실행.

개미맨 2020. 10. 15. 11:00

 

digitalocean.com/community/questions/how-to-start-docker-containers-automatically-after-a-reboot

 

How to Start Docker Containers Automatically After a Reboot? | DigitalOcean

Recently one of my servers crashed and after the reboot, none of my Docker containers started. So I had to manually check each container and start the ones that were required. That is when I realized that I should implement a restart policy to control

www.digitalocean.com

docs.docker.com/config/containers/start-containers-automatically/

 

Start containers automatically

 

docs.docker.com

 

서버 재부팅 시 컨테이너를 다시 실행 한다.

$ docker update --restart unless-stopped [container_id]

 

There are a few other flags that you could specify to the --restart argument.

Argumen Description
no This is the default value, it means that the containers would not be restarted
on-failure This would restart the container in case that there is an error and the container crashes
always Always restart the container if it stops
unless-stopped The container would always be restarted unless it was manually stopped