8

The docker-compose documentation states that:

cpu_count, cpu_percent, cpu_shares, cpu_period, cpu_quota, cpus, cpuset, domainname, hostname, ipc, mac_address, mem_limit, memswap_limit, mem_swappiness, mem_reservation, oom_kill_disable, oom_score_adj, privileged, read_only, shm_size, stdin_open, tty, user, working_dir

Each of these is a single value, analogous to its docker run counterpart.

But the docker run documentation they reference only mentions cpus. There's no mention of cpu_count:

--cpus=0.000 Number of CPUs. Number is a fractional number. 0.000 means no limit.

So what does cpu_count do?

Community
  • 1
  • 1
Malt
  • 28,965
  • 9
  • 65
  • 105
  • Both [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) and [`docker container run`](https://docs.docker.com/engine/reference/commandline/container_run/) mention that `--cpu-count` is a *"Windows only"* option. – tgogos Jun 20 '19 at 08:56
  • I missed that. Thanks. Still, though, what does it do? – Malt Jun 20 '19 at 08:58
  • Based on what I found, `cpu_count` and `cpu_percent` are Windows only option. It seems `cpu_count` fix the number of CPU allowed (waiting for an integer) and `cpus` specify how much of the available CPU resources a container can use (wainting for a float). – youri Jun 20 '19 at 09:31
  • These flags are used in order to [Limit a container's resources](https://docs.docker.com/config/containers/resource_constraints/#cpu). For the Linux case, they are used to configure `cgroups` (see more here: [How to allocate 50% CPU resource to docker container?](https://stackoverflow.com/questions/26841846/how-to-allocate-50-cpu-resource-to-docker-container) and [Resource management in Docker](https://goldmann.pl/blog/2014/09/11/resource-management-in-docker/#_cpu)). Maybe `cpu-count` is something similar for `hyper-v`. – tgogos Jun 20 '19 at 09:34

1 Answers1

0

it is for windows. Here is the runtime level configuration that it gets passed to: https://github.com/opencontainers/runtime-spec/blob/main/config-windows.md#cpu

vbatts
  • 11