docker compose: services.x Additional property y is not allowed / yaml: line N: mapping values are not allowed
The compose file is invalid YAML or uses a key Compose doesn’t recognise at that level (usually an indentation mistake).
Seen on:
Docker
Meaning
YAML is indentation-sensitive. A key indented one level too far or too little ends up under the wrong parent, producing “Additional property … is not allowed”. Tabs and unquoted colons cause “mapping values are not allowed”.
Common causes
- Wrong indentation (key under the wrong parent)
- Tabs instead of spaces
- Unquoted values containing
:(e.g. command strings) - Typos in keys (
enviroment,port) - Old
version:/ v2-only keys with Compose v2
⚡ Quick fix
- Validate:
docker compose config - Use 2-space indentation, no tabs
- Quote strings containing colons
- Check key spelling against the Compose spec
Detailed fix by platform
Docker
- Correct structure:yaml
services: web: image: nginx:1.27 ports: - "8080:80" # quoted: contains a colon environment: APP_ENV: production
How to diagnose
- Validate —
docker compose configoutput - Line — Which line/key is reported?
- Whitespace — Tabs or mixed indentation?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026