Skip to content
Latchkey

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 confusion

Common 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

  1. Delete the top-level version: line from the compose file.
docker-compose.yml
# remove this line:
# version: "3.8"
services:
  web:
    image: myorg/app:ci

Stop treating the deprecation warning as fatal

  1. If you must keep the key, ensure the CI step does not fail on benign stderr output.
Terminal
docker compose config --quiet

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →