docker container restart strategy

View docker container restart strategy

docker inspect containers ID

 

docker run -d --restart=always bba-208
docker run -d --restart=on-failure:10 bba-208

Restart strategy Docker containers

Docker containers restart strategy for the production environment is a startup policy, the development process can ignore the policy.

Docker containers are made to restart the daemon complete Docker, so closely linked with the daemon.

Docker containers restart strategy are as follows:

  • no, the default policy does not restart the container when the container exit
  • on-failure, when the container is non-normal exit (exit status 0), before restarting the container
  • on-failure: 3, restart the container when the container is non-normal exit, restart up to 3 times
  • always, always exit the restart when the container vessel
  • unless-stopped, when the container exits the container always restart, but does not consider at the time of Docker daemon is started has been discontinued container

docker run of --restart options

By --restart option, you can set policies to restart the container to determine when the container exit Docker whether to restart the daemon just quit container.

--restart option is usually only used for container detached mode.

--restart option can not be used with --rm options. Clearly, - restart option applies to container detached mode, and --rm options are available for container foreground mode.

When docker ps view of the container, using the container --restart options, which may or Restarting Up state only two states.

 

Guess you like

Origin www.cnblogs.com/shix0909/p/11387185.html