O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating a restart policy on a running container

Sometimes, there's a need to update the Docker runtime parameters after the container has already started, on the fly. An example would be if you want to prevent containers from consuming too many resources on the Docker host. To set the policy during runtime, we can use the docker update command. Apart from other runtime parameters (such as memory or CPU constraints for example, which we are going to discuss later in this chapter), the docker update command gives you the option to update the restart policy on a running container. The syntax is quite straightforward, you just need to provide the new restart policy that you would like the container to have and the container's ID or name:

$ docker ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required