Docker Community Forums

Share and learn in the Docker community.

Docker-Container Resources assign!


(Kirasakuya) #1

Hallo everyone,
If I have two containers. At first container I have the application “Skype” and at the second container “WordPress”. The resources are shared on the two containers 50/50. If via Skype containers a video conference, he gets the Ressorcen 70/30. Is it possible the resources automatically assign to the active container. With resources I mean (RAM, CPU, Internet connection)

Thanks


(Nathan Le Claire) #2

docker run has a huge variety of features to control resource usage for processes. Probably use these.

$ docker run --help | grep blk
      --blkio-weight value          Block IO (relative weight), between 10 and 1000
      --blkio-weight-device value   Block IO weight (relative device weight) (default [])

$ docker run --help | grep cpu
      --cpu-percent int             CPU percent (Windows only)
      --cpu-period int              Limit CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int               Limit CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares int              CPU shares (relative weight)
      --cpuset-cpus string          CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string          MEMs in which to allow execution (0-3, 0,1)

$ docker run --help | grep mem
      --cpuset-mems string          MEMs in which to allow execution (0-3, 0,1)
      --kernel-memory string        Kernel memory limit
  -m, --memory string               Memory limit
      --memory-reservation string   Memory soft limit
      --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --memory-swappiness int       Tune container memory swappiness (0 to 100) (default -1)

(Nathan Le Claire) #3

As for “active container”, there’s no way to know what that means. The Linux kernel treats processes “completely fair” by default.


(Nathan Le Claire) #4

also these

      --device-read-bps value       Limit read rate (bytes per second) from a device (default [])
      --device-read-iops value      Limit read rate (IO per second) from a device (default [])
      --device-write-bps value      Limit write rate (bytes per second) to a device (default [])
      --device-write-iops value     Limit write rate (IO per second) to a device (default [])