Compose V2

Compose V2, compose.yaml and the Retirement of docker-compose

Compose 514 grew out of Fig, a Python tool that Docker 514 acquired in 2014 and renamed docker-compose. Compose V2, first released in 2020, is a Go rewrite that ships as a Docker CLI plugin, so the command is docker compose with a space. Compose V1 stopped receiving updates in July 2023. V2 also names containers with hyphens (booknest-db-1, not booknest_db_1), which breaks scripts that parse names. On 2 December 2025 the project jumped from 2.x straight to 5.0.0, skipping 3 and 4 to avoid confusion with the old file-format versions 2.x and 3.x; the same release made Compose usable as a Go SDK and handed image builds to Buildx 4,514 bake (buildx bake). This chapter runs Compose v5.5.1.

The file format changed too. The old version: '3.7' line selected a schema; today one Compose Specification covers every release, and the line only earns a warning:

The version attribute is obsoleteShell
docker compose version
{ echo "version: '3.7'"; cat docker-compose.yml; } > ../old.yaml
docker compose -f ../old.yaml config -q 2>&1 | grep -o 'the attribute.*ignored'
Output
Docker Compose version v5.5.1
the attribute `version` is obsolete, it will be ignored

Compose looks for compose.yaml first, then compose.yml, and still accepts the legacy docker-compose.yaml and docker-compose.yml. BookNest's baseline has a docker-compose.yml that starts PostgreSQL 1,289 alone; the next subsection replaces it with a compose.yaml for the whole stack.