Compose: docker-compose does not support cpus parameter

Created on 7 Mar 2017  路  14Comments  路  Source: docker/compose

docker-compose does not support cpus parameter:
ERROR: The Compose file '.\.\docker-compose.test.yml' is invalid because: Unsupported config option for services.test: 'cpus'
Please add support for --cpus parameter.

areconfig docker-py formav2 kinfeature

Most helpful comment

Why option cpu-count called so? It's the incorrect name, because for cpu_count: 1 I expect that only 1 CPU will be active. However, I see only the loading on the baseline performance.
Also, very very bad documentation and there aren't any explanations about cpu* options for "windows only".
I don't understand why you removed these options from the compose 3.* versions.
My problem is I need to restrict my windows containers for CPUs utilization, but I don't see clarify solutions for it which similar to the behavior of --cpuset-cpus option in Linux.

All 14 comments

Are you referring to this: https://docs.docker.com/compose/compose-file/#resources ?

If so, it needs to be a subkey of services.test.deploy.limits or services.test.deploy.reservations

I mean docker-compose itself.
Version 2.x (which I currently use) of docker-compose.yml does not support cpus parameter (--cpus for docker run).
Version 3.x supports it but documentation states that docker-compose ignores section deploy: https://docs.docker.com/compose/compose-file/#deploy

@shin- Hi Joffrey,

It is very important issue for Windows Server 2016 containers as --cpus/--cpu-count/--cpu-percent parameters is the only way to limit cpu consumption. So, just for now, docker-compos is not production ready for Windows containers as we can configure these parameters.

Ah, I see. Those were added recently (Engine 1.13). We're most likely going to need a Compose file format 2.2 to support those.

@shin- Hi Joffrey,

I see that you referenced this issue to the pull request https://github.com/docker/compose/pull/4262 but it seems that they are not related between each other.

Btw, do we have any ETA for implementing this current feature?

@shin- Hi
As I understand, docker-compose depends on docker-py. And it is required to implement cpus, cpu-count and cpu-percent in docker-py before docker-compose. Is it correct?

@georgyturevich Sorry, indeed - #4262 is fixed by #4588.
ETA for this feature is Compose 1.13

@AlexeyRokhin Yes! I see you submitted https://github.com/docker/docker-py/pull/1532 - I'll take a closer look at it ASAP.

@shin- Hi Joffrey
Pull request for compose is created:
https://github.com/docker/compose/pull/4835

Hello, I encountered this but I shouldn't because my docker-compose version is 1.13 and docker-compose file version is 2.2. Any ideas why?

$ docker-compose --version
$ docker-compose version 1.13.0, build 1719ceb

It was added in 1.14. Please upgrade to the latest version.

I see, thanks.

Still having the issue with docker create service --cpu or ----limit-cpu not worked with windows server 2019 with docker 18.9 latest version with docker ce edition.

please help

Why option cpu-count called so? It's the incorrect name, because for cpu_count: 1 I expect that only 1 CPU will be active. However, I see only the loading on the baseline performance.
Also, very very bad documentation and there aren't any explanations about cpu* options for "windows only".
I don't understand why you removed these options from the compose 3.* versions.
My problem is I need to restrict my windows containers for CPUs utilization, but I don't see clarify solutions for it which similar to the behavior of --cpuset-cpus option in Linux.

Why option cpu-count called so? It's the incorrect name, because for cpu_count: 1 I expect that only 1 CPU will be active. However, I see only the loading on the baseline performance.
Also, very very bad documentation and there aren't any explanations about cpu* options for "windows only".
I don't understand why you removed these options from the compose 3.* versions.
My problem is I need to restrict my windows containers for CPUs utilization, but I don't see clarify solutions for it which similar to the behavior of --cpuset-cpus option in Linux.

They removed it because they are nincompoops.

Was this page helpful?
0 / 5 - 0 ratings