CPU
By default, each container’s access to the host machine’s CPU cycles is unlimited. Docker uses the default Completely Fair Scheduler (CFS) but also supports the Real-time Scheduler.
CPU Shares
By default, Docker assigns a CPU share of 1024 to each container. CPU shares specify how the host’s total CPU resources are proportionally shared among containers — they are not hard limits.CPU Sets
Limits a container to specific CPUs or cores. CPUs are numbered from 0.0-3— Use the first four CPUs1,3— Use the second and fourth CPUs
CPU Count
Specifies the maximum amount of available CPU a container can use. If the host has 4 CPUs and you set--cpus=2.5, the container can use at most 2.5 CPUs.
Memory
Set the maximum amount of memory a container can use:m (megabytes), g (gigabytes).
Swap Space
Sum of memory =
--memory + swap spaceBy default, Docker allocates the same amount as --memory for swap, effectively doubling the total memory available.--memory-swap:
Additional Options
--memory-reservation sets a soft limit that is activated when Docker detects low memory or contention on the host. It must be set lower than --memory and does not guarantee the container stays under the limit — it’s a best-effort reservation.