🔧 Error Fixes
· 2 min read
Last updated on

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.yml has a version: '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 version field in docker-compose.yml
  • When copying Compose files from tutorials or Stack Overflow, strip the version line
  • 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
📘