docker: command not found
Covers: command not found docker · bash docker command not found · Docker not in PATH — May 2026
🐧 Ubuntu / Debian
🎩 CentOS / RHEL
🍎 macOS
🪟 Windows (WSL)
$ docker run hello-world
bash: docker: command not found
bash: docker: command not found
Two Different Problems
This error has two distinct causes — check which applies to you:
- Docker is not installed — the most common case on a fresh VPS or CI runner
- Docker is installed but your user isn't in the docker group — running
sudo dockerworks butdockeralone fails
⚡ Quick Fix — Install Docker on Ubuntu/Debian
# Official install script (fastest method):
curl -fsSL https://get.docker.com | sh
# Verify it worked:
docker --version
Manual Install on Ubuntu/Debian
# Add Docker's official GPG key and repo:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
-o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) \
signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
Install on CentOS / RHEL / Fedora
# CentOS 7 / RHEL 7:
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker && sudo systemctl enable docker
# CentOS 8+ / RHEL 8+ / Fedora:
sudo dnf install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker && sudo systemctl enable docker
Fix: docker Works with sudo But Not Without
If sudo docker works but docker alone gives "command not found" or "permission denied", your user isn't in the docker group:
# Add your user to the docker group:
sudo usermod -aG docker $USER
# Apply the group change (log out and back in, or use newgrp):
newgrp docker
# Verify:
docker run hello-world
macOS: Install Docker Desktop
Docker Engine doesn't run natively on macOS. You need Docker Desktop:
# Install via Homebrew:
brew install --cask docker
# Then open Docker Desktop from Applications and wait for it to start.
# After it's running, the docker CLI will work in your terminal.