Skip to main content

Posts

Showing posts from April, 2021

Docker restart policy and how to start containers automatically

 Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts.  Note * If you use docker stop or docker kill, it is expected that Docker does not restart the container. In case of docker stop or docker kill, its restart policy is gong to be ignored until the Docker daemon restarts or the container is manually restarted.  Container restart policy : Container restart policy controls the restart actions when Container exits. Following are the supported restart options: no – This is default. Containers do not get restarted when they exit. on-failure – Containers restart only when there is a failure exit code. Any exit code other than 0 is treated as failure. unless-stopped – Containers restart as long as it was not manually stopped by user. always – Always restart container irrespective of exit status. The following example starts a "selenium/node-chrome" container and configures it to always restart unless it is