Docker Community Forums

Share and learn in the Docker community.

What is the difference between the cpus and cpu_count settings in Docker Compose v2.2?


(Jamiewilliams2) #1

What is the difference between the cpus and cpu_count settings in Docker Compose v2.2 and which should I use to allocate a number of cores to my container?

I have gathered that cpu_count is analogous to the docker run flag --cpu-count which is for Windows use only, but I can’t find a description of the difference, and the --cpu_count flag is not consistently present in documentation. It is mentioned here:


but not here:

and it is not mentioned in this guide:

I have reviewed this PR:


but it made me more confused because the unit test for cpu_count isn’t skipped like the cpu_percent test when the platform is Windows, even though both options are documented as being “Windows only” in the commandline reference.

Which is supported on which platform(s)? Are they mutually exclusive? Is the documentation inconsistent or am I just reading it incorrectly?


(Timgriffiths) #2

Good Question did you ever work it out?


(2xnone) #3

Any news about this topic?