Impact & Risk Analysis
- Severity: Medium
- CIS Benchmark: CIS 5.12
- Impact: Resource Starvation / Denial of Service. By default, CPU time is divided equally between containers. If CPU priorities are not set, a low-priority background task (like a batch job) could consume excessive CPU cycles, “starving” high-priority containers (like a web server) and causing them to become unresponsive or suffer from high latency.
Common Misconfiguration
Running containers without defining CPU shares. By default, all containers on a Docker host share CPU resources equally (default weight of 1024). This means critical applications have to fight for resources with non-critical tasks.Vulnerable Example
Secure Example
Audit Procedure
Run the following command to check CPU shares:- Result: Returns the CPU shares value.
- Fail: If it returns
0or1024, defaults are in use (no prioritization). - Pass: If it returns a non-zero value other than
1024(e.g.,512), priorities are enforced.
Remediation
You should manage the CPU runtime between your containers dependent on their priority within your organization. Use the--cpu-shares argument (or cpu_shares in Docker Compose) to assign weights.
- 1024: Default priority.
- 512: Low priority (gets 50% of the CPU time compared to a default container).
- 2048: High priority (gets 2x the CPU time compared to a default container).

