Docker Community Forums

Share and learn in the Docker community.

Run Docker with 2 cores vs Dual Core Machine

Hi there,

This is my first post.

I need to performance test an application on a dual-core and quad-core machine. If I run a docker container with 2 cpus and 4 cpus respectively, would it be equivalent to testing the application on dual core and quad core machine? I would of course be using the same OS and SWAP space as the original machines.

Thank you in advance and I look forward to contributing to the community


by default all can be used, or you can limit it per container using the --cpuset-cpus parameter.

docker run --cpuset-cpus=“0-2” myapp:latest
That would restrict the container to 3 CPU’s (0, 1, and 2). See the docker run docs for more details.

The preferred way to limit CPU usage of containers is with a fractional limit on CPUs:

docker run --cpus 2.5 myapp:latest
That would limit your container to 2.5 cores on the host.

Yes, but would the results be the same as running it on a dual core machine/quad core machine?