Skip to main content

CV-B003: No resource limits

Warning Best Practice

Why This Matters

Without resource limits, a single container can consume all available host CPU and memory, starving other containers and potentially crashing the host. Setting deploy.resources.limits ensures containers have bounded resource consumption and enables fair scheduling across services.

How to Fix

Add deploy.resources.limits with cpus and memory constraints

Before (incorrect)

services:
  web:
    image: nginx

After (correct)

services:
  web:
    image: nginx
    deploy:
      resources:
        limits:
          cpus: "0.50"
          memory: 512M

Rule Details

Rule Code
CV-B003
Severity
Warning
Category
Best Practice

Related Rules