/changelogs/docker-compose/compose-v1-to-v2
docker-compose v1 to docker compose v2: what changed
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · Docker Compose version v5.6.0updated 2026-10-20
- tool
- Docker Compose
- versions
- 1.29 → 2.x and later
Compose v1 was the Python docker-compose tool. Compose v2 is a rewrite in Go that ships as the docker compose plugin of the Docker CLI (Docker Desktop and the docker-compose-plugin package include it); later major versions continue the same line. Most files work unchanged, but a few behaviours differ.
The version key is obsolete
cat > docker-compose.yml <<'EOF'
version: "3.8"
name: demo
services:
web:
image: nginx:1.29
EOF
docker-compose config 2>&1 | sed 's/^time="[^"]*" //'Output
level=warning msg="/tmp/work/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
name: demo
services:
web:
image: nginx:1.29
networks:
default: null
networks:
default:
name: demo_defaultRemove the line: Compose always uses the latest Compose Specification and no longer reads the version number.
Changes that affect scripts
| Area | v1 | v2+ |
|---|---|---|
| Command | docker-compose up | docker compose up (docker-compose may exist as an alias) |
| Container name | demo_web_1 | demo-web-1 |
| File version | version: "3.8" required for v3 features | ignored, warning printed |
| Default file | docker-compose.yml | compose.yaml (old names still found) |
| Build | docker-py builder | BuildKit / buildx by default |
| Profiles, depends_on conditions | partial (file-format dependent) | full Compose Specification |
Migration checklist
- Replace
docker-composewithdocker composein scripts and CI. - Delete the
version:line. - Search for container names with underscores (
_1) and switch to hyphens, or setcontainer_nameexplicitly. - Optionally rename
docker-compose.ymltocompose.yaml.
Sources
Related pages
config · docker-composeCompose depends_on condition: service_healthy with a healthcheckdepends_on with condition: service_healthy makes Compose wait until a dependency's healthcheck passes before it starts the services that depend on it.errors · docker-composeDocker Compose: service "web" depends on undefined service "db"docker compose fails with service "web" depends on undefined service "db" when depends_on names a service missing from the file, the -f list or a profile.compare · dockerDockerfile CMD vs ENTRYPOINT: differences and when to use eachENTRYPOINT sets the executable a container always runs; CMD sets default arguments that docker run can replace. How they combine, and exec form vs shell form.