Update the limitation of memory/CPU for existing container in docker Update the limitation of memory/CPU for existing container in docker docker docker

Update the limitation of memory/CPU for existing container in docker


Docker Update Command

docker update --memory "1g" --cpuset-cpu "1" <RunningContainerNameOrID>

this will update the "RunningContainerNameOrId" to use 1g of memory and only use cpu core 1

To up date all running containers to use core 1 and 1g of memory:

docker update --cpuset-cpus "1" --memory "1g" $(docker ps | awk 'NR>1 {print $1}')


Dynamic resource allocation is currently not possible with only Docker. You would have to update the cpu/memory shares of the cgroup (control group). You must create a new container to change the resource limitations with Docker.

There is a Docker GitHub issue for dynamic resource configuration. This pull request suggests it will be added in Docker 1.10 with a docker set or docker update command. This command will allow you to update a container's configuration at runtime.

If you are running on a systemd enabled system, you can leverage that as well to change the cpu or memory shares. An example can be found in this blog post.