CV-M001: Duplicate exported host ports
Error Semantic
Why This Matters
Two or more services export the same host port, which causes a port binding conflict when Docker Compose starts the stack. Only one container can bind a given host port on the same IP address and protocol at a time. Docker Compose will fail at startup with "Bind for 0.0.0.0:PORT failed: port is already allocated". This rule detects single-port duplicates; range overlaps are caught by CV-M014.
How to Fix
Assign unique host ports to each service or bind to different IP addresses.
Before (incorrect)
services:
web:
ports:
- "8080:80"
api:
ports:
- "8080:3000" After (correct)
services:
web:
ports:
- "8080:80"
api:
ports:
- "8081:3000" Rule Details
- Rule Code
- CV-M001
- Severity
- Error
- Category
- Semantic