I have a 4-core CPU, I want to allocate 50% CPU resource to a docker container.
After reading the docker-run manual and config.go source code.
I still don\'t know ho
Since Docker 1.13, in your 4-core machine just add docker container run --cpus 2.0 [args...].
Explanation from this blog post:
In 1.13 though, if you want a container to be limited to one cpu then you can just add
--cpus 1.0to your Docker run/create command line. If you would like two and a half cpus as the limit of the container then just add--cpus 2.5. In Docker we are using the CFS quota and period to limit the container’s cpu usage to what you want and doing the calculations for you.
Also check the docs.