Skip to main content

Políticas restart | Restart Policies | Docker

  • Políticas restart | Restart Policies | Docker

  • no: Containers won't restart automatically.

  • on-failure[:max-retries]: Restart the container if it exits with a non-zero exit code, and provide a maximum number of attempts for the Docker daemon to restart the container.

  • always: Always restart the container if it stops.

  • unless-stopped: Always restart the container unless it was stopped arbitrarily, or by the Docker daemon.

Alterar container já rodando

docker update --restart=unless-stopped nome_do_container

Conferindo se deu tudo certo

docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' nome_do_container