Skip to main content

CV-M006: Undefined config reference

Error Semantic

Why This Matters

A service references a config that is not defined in the top-level configs section. Docker Compose requires all configs used by services to be declared at the top level with either a file path, content, or an external flag. Without a matching top-level declaration, Compose will fail at startup with a "config not found" error.

How to Fix

Define the referenced config in the top-level configs section.

Before (incorrect)

services:
  web:
    configs:
      - nginx_conf
# No top-level configs defined

After (correct)

services:
  web:
    configs:
      - nginx_conf
configs:
  nginx_conf:
    file: ./nginx.conf

Rule Details

Rule Code
CV-M006
Severity
Error
Category
Semantic

Related Rules