It's plausible that machines in a cluster have different numbers of cores. Docker Swarm mode's deploy.resources.limits.cpus
config specifies the absolute number of cores. Is it possible to specify a percentage of the total available CPU resources? I want the total CPU limit to be close to 100% of the max capacity.
dockerfile snippet:
deploy:
resources:
limits:
cpus: '1'
memory: 4G
no.
If you have a service that actually can benefit from multiple cores, set the cpu limit to the a reasonable common divisor of the min and max cores your nodes have available, and then just set the replicas to a number such that deploy.replicas * deploy.resource.limits.cpus ~= total-swarm-cpus.