Docker Compose "the attribute version is obsolete" (warning to error) in CI
Compose v2 ignores the top-level version: key and prints a deprecation warning. Most pipelines tolerate the warning, but CI that fails on any stderr output (or a lint gate) turns it into a build failure. Removing the obsolete key clears it.
What this error means
A docker compose command prints the attribute "version" is obsolete, it will be ignored, please remove it to avoid potential confusion and the step fails because stderr is treated as an error.
docker
WARN[0000] /app/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusionCommon causes
A leftover top-level version key
Compose v2 no longer uses version:; its presence triggers the deprecation warning.
A strict CI gate failing on warnings
A step that fails on any stderr output (or a --quiet/lint check) escalates the warning to an error.
How to fix it
Remove the version key
- Delete the top-level
version:line from the compose file.
docker-compose.yml
# remove this line:
# version: "3.8"
services:
web:
image: myorg/app:ciStop treating the deprecation warning as fatal
- If you must keep the key, ensure the CI step does not fail on benign stderr output.
Terminal
docker compose config --quietHow to prevent it
- Drop the top-level
version:key on Compose v2. - Reserve hard-fail-on-stderr gates for real errors, not deprecation notices.
Related guides
Docker Compose "the attribute version is obsolete" WarningUnderstand the Docker Compose "the attribute version is obsolete" warning in CI - harmless, but a sign you ma…
Docker Compose "Additional property X is not allowed" in CIFix Docker Compose "Additional property X is not allowed" in CI - a misspelled or misindented key that fails…
Docker Compose "develop.watch" - Invalid Config / Unknown Action in CIFix Docker Compose "develop.watch" validation errors in CI - an unknown watch action, a missing path/target,…