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