validating ...\compose.yaml: services.web.enviroment false schema means
Compose found a key it does not know at that path. Here environment was
misspelled. Correct the key named in the message and run the command again.
The path after the file name is the whole diagnosis: services.web is where
the key sits, and the last part, enviroment, is the key Compose rejected.
Compare its spelling with the key you meant, letter by letter.
The error
PS> docker compose config --quiet
validating C:\...\c4\compose.yaml: services.web.enviroment false schema
docker compose up stops with the same line before it creates anything. The
file that produced it:
name: fix8-cli-c4
services:
web:
image: alpine
command: ["sleep", "1"]
enviroment:
- GREETING=hello
Why it happens
Compose validates the file against the Compose Specification's JSON schema before it
does anything else. A service only allows the keys the schema lists, and anything else
fails validation. Compose v5.6.1 reported it as false schema. Many older
answers online quote Additional property enviroment is not allowed for the
same mistake. The message does not suggest the correct spelling, so it is easy to
read past a one-letter typo.
The check runs before any container, network or image work, so nothing is created
when it fails: both config and up stopped on the same single
line. The file is valid YAML, which is why this is not a parser error with a line and
column, but a path into the file's structure.
The fix
name: fix8-cli-c4
services:
web:
image: alpine
command: ["sh", "-c", "echo $$GREETING"]
environment:
- GREETING=hello
PS> docker compose -f compose.fixed.yaml config --quiet
PS> docker compose -f compose.fixed.yaml up
web-1 | hello
With the key spelled environment, config --quiet prints
nothing and exits with 0, and the container sees the variable. Make
docker compose config --quiet the first check after editing a Compose file:
it validates without creating anything. The up output above is trimmed to
the container's own line; the network and container lines around it are left out.
How it was reproduced
Docker Desktop on Windows 11, engine 29.9.2, Docker Compose v5.6.1, Windows PowerShell
5.1, the cached alpine:latest image. A one-service compose.yaml
with enviroment gave the message above on both config and
up; the corrected file validated and printed hello. The
project name fix8-cli-c4 is the test's own; the long folder path is
shortened to C:\...\c4, nothing else changed.
Frequently asked
- What does false schema mean in docker compose?
- Compose validated the file against its JSON schema and found a key that is not allowed at that path. The last part of the path in the message is the rejected key; in this test it was a misspelled environment.
- How do I validate a docker compose file without running it?
- Run docker compose config --quiet in the folder of the file. It prints nothing and exits with 0 when the file is valid, and prints the problem otherwise.
- Is false schema the same as Additional property is not allowed?
- Additional property ... is not allowed is the wording many older answers quote for the same mistake, a misspelled or misplaced key. Compose v5.6.1 printed false schema for it in this test.
More decoded errors in the Fixes category. For a Compose file that fails because a dependency is missing, see depends on undefined service.