Dynamically Update Docker Container Configuration

This article is going to talk about the benefits of using a dynamically updating Docker container configuration.

The first benefit that should be noted is that it does not require shutting down or restarting the container. The second significant benefit of this approach is the ability to distribute software changes as soon as they are made without having to go through a complicated update process.

Update

In the following example, I’m deploying a Docker container with 512MB of RAM.

docker run -it --name deploy1  --memory=512m ubuntu /bin/bash

After deploying the container, I will use the docker status command to check how much memory is configured on the container, and as shown in the output, the container has a max limit of 512MB.

docker stats

Now, let’s update the container to use 256MB of RAM. I will run the command without shutting down the container, and the output is shown in the screenshot.

docker update --memory=256m  deploy1 

The update command can update CPU, memory, kernel memory and restart policy.


Posted

in

by