Forrest logo
back to the docker tool

docker:tldr:169c1

docker: Update restart policy to apply when a specific container exits.
$ docker update --restart=${select} ${container_name}
try on your machine

The command docker update --restart=${select} ${container_name} is used to update the restart policy of a Docker container.

Here's a breakdown of the command:

  • docker update is the command used to update a container's configuration.
  • --restart=${select} is an option used to specify the restart policy. The ${select} variable is used here to represent a specific restart policy value. The actual value could be one of no, on-failure, always, or other supported restart policies defined by Docker.
  • ${container_name} is the name or ID of the Docker container that you want to update.

The restart policy determines how Docker will handle the restarting of a container when it exits. The available restart policies are:

  • no or "": Do not automatically restart the container.
  • on-failure[:max-retries] or unless-stopped: Restart the container only if it exits with a non-zero exit code. Optionally, specify the maximum number of restart attempts.
  • always: Always restart the container regardless of the exit code.

Using this command, you can modify the restart policy of a running Docker container to match your specific requirements.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool