Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am aware that I can limit the resources allocated to a container while provisioning using docker with the -c and -m flags for CPU and memory.

However, is there a way I can change these allocated resources to containers dynamically (after they have been provisioned) and without redeploying the same container with changed resources?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

At the time (Docker v1.11.1) has the command docker update (view docs). With this you can change allocated resources on the fly.

Usage:  docker update [OPTIONS] CONTAINER [CONTAINER...]

Update configuration of one or more containers

  --blkio-weight          Block IO (relative weight), between 10 and 1000
  --cpu-shares            CPU shares (relative weight)
  --cpu-period            Limit CPU CFS (Completely Fair Scheduler) period
  --cpu-quota             Limit CPU CFS (Completely Fair Scheduler) quota
  --cpuset-cpus           CPUs in which to allow execution (0-3, 0,1)
  --cpuset-mems           MEMs in which to allow execution (0-3, 0,1)
  --help                  Print usage
  --kernel-memory         Kernel memory limit
  -m, --memory            Memory limit
  --memory-reservation    Memory soft limit
  --memory-swap           Swap limit equal to memory plus swap: '-1' to enable unlimited swap
  --restart               Restart policy to apply when a container exits

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...