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'.

Published · Updated ~5 min read
On this page

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

Both install commands above include it, as the package docker-compose-plugin. If a script of yours still calls docker-compose, update it to the space-separated form, or give the plugin the old name once (the path of Docker’s packages):

Linux
sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose

Manual installs, macOS, Windows and CI runners are covered in docker-compose: command not found.

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 Compose with restart: unless-stopped is also an easy way to keep a Discord or Telegram bot running: see bot hosting.

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. On an Ubuntu VPS, the install script above works as written.

Another tool missing, or a directory to add to PATH for good in bash, zsh and fish? See command not found: the three causes and the fix for every tool.

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.

Related articles

All troubleshooting

Install Docker on Ubuntu 24.04 and Debian 12/13 from the official repository

Install Docker Engine and Compose from Docker's apt repository on Ubuntu 24.04 or Debian 12/13, run it without sudo and stop it bypassing your firewall.

docker-compose: command not found? Install the Compose plugin and keep old scripts working

docker-compose is the retired Compose v1. Install the Compose plugin (docker-compose-plugin), run docker compose, or link docker-compose to it for old scripts.

systemctl: command not found? You are not on systemd

systemd is not PID 1. In Docker run the program directly, on Alpine use rc-service, on WSL set systemd=true in /etc/wsl.conf, on macOS use brew services.

bash: command not found / zsh: command not found? The three causes and the fix for every tool

Why bash and zsh say 'command not found': the program is missing, not on your PATH, or the name is stale. Diagnose it with type -a and fix PATH for good.

n8n vs Zapier vs Make: self-hosted vs SaaS, and what each costs

n8n is source-available (fair-code) and self-hostable with no per-task bill; Zapier and Make are SaaS billed per task or operation. What that means for you.

Docker commands cheat sheet: containers, images, Compose and cleanup

docker ps, rm, rmi, compose up -d and system prune: the Docker commands used daily, grouped by containers, images, Compose and freeing up disk space.

How to stop and remove Docker containers, images and volumes

Docker remove container and image commands: docker stop, rm -f, rmi, prune with -a and --volumes, the image is being used error and docker system df.