How to Install Docker Compose on Linux (Compose v2 Plugin)

docker compose install linux - custom-compose-featured.png

Searches for docker compose install still spike because the old docker-compose (v1, hyphen) was replaced by docker compose (v2, plugin). New tutorials should only teach v2.

Install Docker Engine first — Docker on AlmaLinux/Ubuntu — then add the Compose plugin and follow
production stack patterns when you go beyond a laptop demo.

Compose v2 vs docker-compose v1

v2 is integrated: docker compose up. The standalone Python v1 binary is legacy.

Compose v2
plugin model

Install the Plugin Package

On official Docker repos the package is usually docker-compose-plugin.

bashverify
docker compose version
docker compose ls 2>/dev/null || true
install plugin
verify version

Minimal compose.yaml

Define services, images or builds, ports, and volumes in one file.

yamlcompose.yaml
services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
    restart: unless-stopped
compose.yaml
services

docker compose up -d

Detached mode starts containers in the background.

bashstart stack
docker compose up -d
docker compose ps
docker compose logs -f --tail=50
up -d
ps and logs

Stop and Remove

down -v deletes named volumes — data loss risk.

bashstop
docker compose down
docker compose down -v   # only if you mean to wipe volumes
down
volumes caution

Production Habits

Use restart: unless-stopped, pin image tags, keep secrets in .env not in git.

NoteDocker publishes ports via iptables — review UFW interaction in our Docker install guide.
production
restart env

Verify the Stack

Hit published ports and check container health if defined.

bashtest
curl -sI http://127.0.0.1:8080/
health
curl

Quick Reference

  • Use docker compose (space), not legacy docker-compose
  • Package: docker-compose-plugin
  • Careful with docker compose down -v

Related tutorials

Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.