compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose does not support cpus parameter

Open AlexeyRokhin opened this issue 9 years ago • 15 comments

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.

AlexeyRokhin avatar Mar 07 '17 17:03 AlexeyRokhin

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

shin- avatar Mar 07 '17 23:03 shin-

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

AlexeyRokhin avatar Mar 08 '17 07:03 AlexeyRokhin

@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.

georgyturevich avatar Mar 08 '17 10:03 georgyturevich

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- avatar Mar 08 '17 23:03 shin-

@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?

georgyturevich avatar Mar 20 '17 09:03 georgyturevich

@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?

AlexeyRokhin avatar Mar 23 '17 08:03 AlexeyRokhin

@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- avatar Mar 23 '17 22:03 shin-

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

AlexeyRokhin avatar May 17 '17 14:05 AlexeyRokhin

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

uLan08 avatar Dec 11 '17 03:12 uLan08

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

shin- avatar Dec 11 '17 04:12 shin-

I see, thanks.

uLan08 avatar Dec 11 '17 04:12 uLan08

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

praveenkdevops avatar Apr 04 '19 10:04 praveenkdevops

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.

yakovenkoroman1993 avatar Jun 12 '19 06:06 yakovenkoroman1993

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.

petar-dambovaliev avatar Jun 20 '20 21:06 petar-dambovaliev

Kubernetes here we go, Docker you have been a great buddy but lack of CPU limiting made you fall short.

itsvrl avatar Jan 13 '22 16:01 itsvrl