VMHeaven

Troubleshooting

docker: command not found — install Docker properly

Docker is never bundled with Linux. Install it from the official repository, fix the 'permission denied' follow-up, and use the modern 'docker compose'.

Updated 08 Aug 2026~5 min read

docker: command not found means the Docker CLI is not installed or not on your PATH. It is never bundled with Linux, so on a fresh server this is expected. Install it from Docker’s official repository rather than the often-outdated distro package.

Install with the official convenience script

The quickest correct method on Debian and Ubuntu is Docker’s own script, which adds the right repository and installs the engine plus the Compose plugin:

Debian · Ubuntu
curl -fsSL https://get.docker.com | sudo sh
sudo systemctl enable --now docker
Rocky · Alma · RHEL
sudo dnf config-manager --add-repo \
  https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable --now docker

Verify

check
docker --version
sudo docker run --rm hello-world

“docker: command found, but permission denied”

A related error: the command exists but talking to the daemon needs root. Add your user to the docker group so you can drop the sudo:

run docker without sudo
sudo usermod -aG docker $USER
# log out and back in, then:
docker ps

“docker-compose: command not found”

Compose is now a subcommand, not a separate binary. The hyphenated form is retired:

Compose v2
docker compose version      # correct
# docker-compose up        # old, may be absent

If a script still calls docker-compose, install the compatibility package docker-compose-plugin (included by the script above) or update the script to the space-separated form.

If it is installed but not found

locate the binary
command -v docker || ls -l /usr/bin/docker
hash -r    # clear a stale shell lookup, then retry

Docker wants a real kernel, so it runs best on KVM virtualisation, not container-based VPS types. Every VMHeaven KVM plan gives you full kernel control, which is what Docker (and nested containers) need.

Frequently asked

Should I install Docker from apt or the official script?

Prefer Docker's official repository or convenience script. Distro packages are often several versions behind and may lack the Compose plugin.

Why does 'docker-compose' say command not found?

Compose v2 is a subcommand: run 'docker compose' with a space. The hyphenated binary is retired; install docker-compose-plugin if a script still needs the old name.

Why does docker need sudo?

Talking to the daemon requires root. Add your user to the 'docker' group to drop sudo — but note that membership is effectively root-level access.

More in Troubleshooting

See all