Skip to main content

CV-M014: Port range overlap between services

Warning Semantic

Why This Matters

Port ranges exported by different services overlap, causing binding conflicts. When one service exports ports 8000-8010 and another exports 8005-8015, ports 8005-8010 are bound by both, which fails at startup. This rule specifically catches range-based overlaps (single-port duplicates are caught by CV-M001).

How to Fix

Adjust port ranges so they do not overlap between services.

Before (incorrect)

services:
  web:
    ports:
      - "8000-8010:8000-8010"
  api:
    ports:
      - "8005-8015:8005-8015"

After (correct)

services:
  web:
    ports:
      - "8000-8010:8000-8010"
  api:
    ports:
      - "8011-8021:8011-8021"

Rule Details

Rule Code
CV-M014
Severity
Warning
Category
Semantic

Related Rules