Docker Compose: Version Is Obsolete β How to Fix It
You run docker compose up and see:
WARN[0000] /path/to/docker-compose.yml: `version` is obsolete
Itβs a warning, not an error β your containers still start. But itβs noisy and signals youβre using an outdated format.
What causes this
Docker Compose V2 (the docker compose plugin, not the old docker-compose standalone binary) no longer uses the version field in docker-compose.yml. The field was originally used to tell Compose which schema version to use (2.x, 3.x, etc.). In Compose V2, the schema is unified and the version field is simply ignored.
Youβll see this warning when:
- Your
docker-compose.ymlhas aversion: '3.8'(or any version) line at the top - You upgraded Docker Desktop or your Docker Engine to a version that ships Compose V2
- Youβre following an older tutorial or using a boilerplate that still includes the version field
Fix 1: Remove the version line
Just delete it. Thatβs the fix:
# β Old format
version: '3.8'
services:
web:
image: nginx
db:
image: postgres:16
# β
New format β just remove the version line
services:
web:
image: nginx
db:
image: postgres:16
Everything else stays the same. The services, networks, volumes, and other top-level keys work exactly as before.
Fix 2: Use the new docker compose command
If youβre still using the old standalone docker-compose (with a hyphen), switch to the built-in plugin:
# β Old command (standalone binary)
docker-compose up
# β
New command (Compose V2 plugin)
docker compose up
The V2 plugin is included with Docker Desktop and modern Docker Engine installations. Itβs faster and actively maintained. The old standalone binary is deprecated.
Check which version youβre running:
docker compose version
# Docker Compose version v2.x.x
Fix 3: Suppress the warning (if you canβt remove version yet)
If youβre in a situation where you need to keep the version field (e.g., shared config that must also work with older Compose), you can suppress the warning by redirecting stderr:
docker compose up 2>/dev/null
But this hides all warnings, which isnβt ideal. The better approach is to just remove the field β Compose V2 ignores it, and Compose V1 is end-of-life.
Fix 4: Update your CI/CD pipelines
If your CI uses Docker Compose, update the commands there too:
# GitHub Actions example
- name: Start services
run: docker compose up -d
# Not docker-compose up -d
Make sure your CI runner has a recent Docker version. If itβs using an old version with only Compose V1, you may need to keep the version field until the runner is updated.
How to prevent it
- When starting new projects, donβt include a
versionfield indocker-compose.yml - When copying Compose files from tutorials or Stack Overflow, strip the
versionline - Use
docker compose(no hyphen) everywhere β scripts, CI, documentation - If you maintain shared Compose files, do a quick find-and-remove across your repos:
grep -r "^version:" */docker-compose.yml
Related: Docker Cheat Sheet Β· Docker vs Kubernetes