Install Docker Compose on Linux
Install the official Docker Compose plugin (Compose V2) on Linux using Docker's apt repository, with verification and your first compose file.
DockLog ships as a single-container compose file in our docs. If docker compose is not found on your VPS, this post follows the official Docker Compose installation guide.
Sources: Compose install overview, Install the Compose plugin on Linux, Docker Engine install.
Compose V2 vs the old binary
Modern Docker uses the Compose plugin:
docker compose up -dThe legacy standalone docker-compose binary (hyphenated) is deprecated. Docker's docs mark standalone install as backward compatibility only. Do not follow random blog posts that curl an old docker-compose release unless you are maintaining legacy automation.
| Command style | Status |
|---|---|
docker compose | Current plugin (recommended) |
docker-compose | Legacy standalone (avoid for new servers) |
Prerequisites
You need Docker Engine and Docker CLI installed first. If the daemon is missing, start with Install Docker Engine on Ubuntu and Debian.
Quick check:
docker versionIf that fails, install Engine before continuing.
Recommended: install with apt (plugin package)
When you installed Docker from Docker's official apt repository, Compose is often already present as docker-compose-plugin. Check:
docker compose versionExample output shape:
Docker Compose version v2.x.xIf the command works, you are done. Skip to "First compose file" below.
Install or update the plugin
On Ubuntu or Debian with Docker's repository configured:
sudo apt update
sudo apt install -y docker-compose-plugin
docker compose versionRPM-based distros (Fedora, RHEL, CentOS) use yum instead per the official Linux plugin doc:
sudo yum update
sudo yum install docker-compose-pluginBundled with Engine install
The official Engine install line already includes the plugin:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginIf you followed our Docker Engine install post, you likely have Compose already.
Alternative: Docker Desktop
Docker's recommended path on Mac, Windows, and Linux desktops is Docker Desktop, which bundles Engine, CLI, and Compose. For a headless VPS, use the plugin via apt, not Desktop.
Manual plugin install (when apt is not an option)
Official docs allow downloading the CLI plugin binary from GitHub releases. Manual installs do not auto-update. Prefer the repository method when possible.
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m) -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
docker compose versionFor system-wide install, use /usr/local/lib/docker/cli-plugins/ instead of ~/.docker/cli-plugins/. Pick architecture (x86_64, aarch64, etc.) per the manual install section.
Verify plugin integration
These should all work without docker-compose on PATH:
docker compose version
docker compose ls
docker compose --helpdocker compose ls shows running compose projects on the host. Empty output on a fresh server is normal.
First compose file
Official Compose docs: Quickstart. Minimal example:
# compose.yaml
services:
web:
image: nginx:alpine
ports:
- "8080:80"mkdir -p ~/compose-test && cd ~/compose-test
# paste compose.yaml
docker compose up -d
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080
docker compose downYou want 200 from curl. That confirms pull, create, network, and port publish.
DockLog smoke test
Once Engine and Compose work, try DockLog the way we document it:
services:
docklog:
image: aimldev/docklog:latest
ports:
- "8888:8000"
environment:
DISABLE_AUTH: "true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stoppeddocker compose up -dOpen http://your-host:8888. Full production shape (auth, SECRET_KEY, persistence) is in Compose for production.
Upgrade Compose
With the plugin from Docker's repo:
sudo apt update
sudo apt install docker-compose-pluginSame command upgrades to the latest plugin version available in the repository. Pin Engine and plugin versions together on hosts where reproducibility matters.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
docker: 'compose' is not a docker command | Plugin not installed | apt install docker-compose-plugin |
Old docker-compose v1 behavior | Standalone binary still on PATH | Remove legacy binary, use plugin |
permission denied on socket | User not in docker group | Engine post-install |
| Compose file version errors | Obsolete version: key in YAML | Modern Compose ignores top-level version; see Compose spec |
Pull works, up hangs | Disk full or cgroup limits | df -h, check docker system df |
Compose file tips before production
Official Compose file reference: Compose file.
Practices we use before leaving stacks running:
restart: unless-stoppedon long-running servicesloggingoptions withmax-sizeandmax-file(log management)healthcheckblocks where the app supports them (health checks post)- Secrets via
.envfiles, not committed to git
What to read next
- Docker Engine install (Ubuntu/Debian)
- DockLog compose for production
- Reverse proxy and TLS
- Docker monitoring tools roundup
Official learning path after install: Getting started with Docker and How Compose works.