CV-M005: Undefined secret reference
Error Semantic
Why This Matters
A service references a secret that is not defined in the top-level secrets section. Docker Compose requires all secrets used by services to be declared at the top level with either a file path or an external flag. Without a matching top-level declaration, Compose will fail at startup with a "secret not found" error.
How to Fix
Define the referenced secret in the top-level secrets section.
Before (incorrect)
services:
web:
secrets:
- db_password
# No top-level secrets defined After (correct)
services:
web:
secrets:
- db_password
secrets:
db_password:
file: ./secrets/db_password.txt Rule Details
- Rule Code
- CV-M005
- Severity
- Error
- Category
- Semantic