the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
is a warning, not an error: the Compose file still starts with a line such as
version: "3.8", and Compose ignores that line. In this test the stack started
normally with the warning printed above it. Delete the version: line and the
warning goes away.
The fix is one deleted line at the top of compose.yaml (or
docker-compose.yml). Nothing else in the file needs to change; the service below
it was read the same way with or without it, and in this test the container was not even
recreated.
The error
PS> docker compose up -d
time="2026-11-10T08:50:09+05:30" level=warning msg="C:\\...\\c1\\compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
Network fix9-cmp-c1_default Creating
...
Container fix9-cmp-c1-web-1 Started
The path in the message was shortened here; the rest is as printed. The command exited
with code 0 and docker compose ps showed the container up, printing the same
warning again. The file that produced it:
version: "3.8"
name: fix9-cmp-c1
services:
web:
image: alpine
command: ["sleep", "300"]
Why it happens
Older Compose files carried a version: key, and files copied from older
tutorials and templates still begin with it. The Compose version used here ignores that key and
says so each time it reads the file: up and ps both printed the
warning in this test. The message names the file by its
full path, so you know which file to edit.
Because the line is ignored, its value does not matter: the warning is about the key
being present at all, not about 3.8 being too old.
The fix
name: fix9-cmp-c1
services:
web:
image: alpine
command: ["sleep", "300"]
PS> docker compose up -d
Container fix9-cmp-c1-web-1 Running
PS> docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
fix9-cmp-c1-web-1 alpine "sleep 300" web 1 second ago Up 1 second
With the line gone, the same up -d reported the running container without a
warning, and the container was not recreated: the change had no effect on the service.
If you keep a name: key, as here, it sets the project name and is not part of
the warning; it stays.
How it was reproduced
One alpine service running sleep 300, in a file whose first line
was version: "3.8", started with docker compose up -d from
Windows PowerShell 5.1 on Docker Engine 29.9.3 and Docker Compose v5.7.0 (Docker Desktop
on Windows 11). The project name carries this test's fix9-cmp- prefix. The
line was then deleted and the same commands run again; the project was removed with
docker compose down -v.
Frequently asked
- Is 'the attribute version is obsolete' an error in Docker Compose?
- No. In this test it was printed as a warning, the command exited with code 0 and the container started. Compose ignores the version line.
- Should I remove version from docker-compose.yml?
- Yes. Deleting the version line removed the warning and changed nothing else: the running container was reported as Running and was not recreated.
- Does the version number in the Compose file matter?
- Not with this Compose version. The warning is about the version key being present, and the value on that line is ignored.
More decoded errors in the Fixes category. When a renamed key stops a file from loading instead of warning, see Docker Compose: false schema from a misspelled key.