Fix 'docker-compose: command not found' — Migrate to Docker Compose V2 (docker compose)
Compose V1 (docker-compose, Python) is end-of-life. Use the V2 plugin with 'docker compose' or install the compose plugin on Linux servers and CI.
bash: docker-compose: command not found
# Debian / Ubuntu: install the V2 plugin sudo apt-get update && sudo apt-get install -y docker-compose-plugin docker compose version # Run your stack docker compose -f docker-compose.yml up -d # Keep old scripts working with an alias echo 'alias docker-compose="docker compose"' >> ~/.bashrc
Root Cause & Mechanism Analysis
Why does this error occur?
Docker Compose V1 was a standalone Python binary named `docker-compose`. It reached end-of-life in 2023 and is no longer shipped. Compose V2 is a Docker CLI plugin invoked as `docker compose` (with a space).
Frequently Asked Questions
Do I need to change my docker-compose.yml?
Need Zero-Knowledge .env Secret Sync Across Your Engineering Team?
Explore Castov Env Vault for client-side AES-256-GCM encrypted environment sharing, or sponsor this engineering hub.
Related Developer Error Solutions
Browse All 69 GuidesDocker Compose: the attribute `version` is obsolete
Modernize `compose.yaml` to the Compose Specification and fix `localhost` vs service-name networking between containers.
Docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
Start the Docker daemon, fix docker.sock permissions, or switch to the right Docker context on Linux, macOS, WSL2 and CI runners.
Docker: Bind for 0.0.0.0:Port Failed
Identify and terminate conflicting host processes or adjust Docker port mapping to resolve port bind collisions.