compose validation Docker Origin: Platform & cloud Last updated 12 Oct 2026

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).

Exact message you may see Additional propertymapping values are not allowed in this contextdid not find expected key
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 not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

.gitlab-ci.yml invalid — GitLab CI: Found errors in your .gitlab-ci.yml: jobs:build config contains unknown keys: scripts (CI/CD).gitlab-ci.yml invalidConfig compilation failed — CircleCI: Error calling workflow: 'build'. Cannot find a definition for job named test / Config does not conform to schema (CI/CD)Config compilation fa…COPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY faileddepends on undefined service — service "web" depends on undefined service "db": invalid compose project (Docker)depends on undefined …docker-compose: command not found — docker-compose: command not found / 'compose' is not a docker command (Docker)docker-compose: comma…error converting YAML to JSON — error converting YAML to JSON: yaml: line 12: did not find expected key (Kubernetes)error converting YAML…IndentationError — IndentationError: unexpected indent / expected an indented block (Python)IndentationErrornetwork not found — Error response from daemon: network X not found (Docker)network not foundcompose v…

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.