Skip to main content

CV-B010: No memory reservation alongside limits

Info Best Practice

Why This Matters

When a container has memory limits but no memory reservation, the scheduler cannot differentiate between the minimum memory needed to function and the maximum allowed. Memory reservations enable graceful scheduling: the orchestrator guarantees the reserved amount and allows bursting up to the limit when resources are available.

How to Fix

Add deploy.resources.reservations.memory alongside the existing memory limit

Before (incorrect)

services:
  web:
    deploy:
      resources:
        limits:
          memory: 512M

After (correct)

services:
  web:
    deploy:
      resources:
        limits:
          memory: 512M
        reservations:
          memory: 256M

Rule Details

Rule Code
CV-B010
Severity
Info
Category
Best Practice

Related Rules