compose validation 🐳 Docker

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

  1. Validate: docker compose config
  2. Use 2-space indentation, no tabs
  3. Quote strings containing colons
  4. Check key spelling against the Compose spec

Detailed fix by platform

Docker

  1. Correct structure:
    yaml
    services:
      web:
        image: nginx:1.27
        ports:
          - "8080:80"          # quoted: contains a colon
        environment:
          APP_ENV: production

How to diagnose

  1. Validate — docker compose config output
  2. Line — Which line/key is reported?
  3. 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.