Changing a Docker container’s restart policy

While researching another article I discovered that it’s now possible to change the restart policy for a container without stopping, deleting and re-running it. Apparently this has also been possible for quite a long time, since Docker 1.11 was released in April 2016.

The docker update command allows you to change the configuration of a container in several ways. To change the restart policy use the ––restart command line option:

$ docker update --restart=always CONTAINER