Docker run's arguments like --memory or --cpus with mac docker desktop

Hi all,
it looks like docker run’s arguments like --memory or --cpus have no effect with docker desktop.
Is it correct?

also when I set number of cores in docker desktop for mac setting cpus to 12 (M2 Max)
I can see that container allocates 10
id it expected, this is an issue?

thanks in advance


How did you check how many cpus the container was using?

I have a tutorial about cpu limits and memory limits and I ran the commands on my Mac M1, but I haven’t tested it recently.

Can you share some commands to reproduce the issue?

1 Like

Hi Akos, thanks for your reply. I think I figured out what’s happening
I was looking at the line from Container’s part of the Docker Desktop dashboard
and it was saying that it allocates 10 cores for macstudio M2, that has 12 cores and I set 12 for resources setting
then I noticed that CPU was ~1200%, so in reality all 12 cores was used I also was able to see that with the following command
docker container stats --no-stream --format “‘{{.MemUsage}}’ {{.CPUPerc}}” <container_name>
as far I understand --cpus and --memory do work and real value will be min of what was set in resources
Aldo if --cpus has value > than was set in resources error will be issued
thanks again