How to Fix the Docker Command Not Found

Docker is a household name in developer circles. It's a low-cost yet robust avenue for testing and deploying applications. It runs applications inside containers, providing isolation that guarantees software will run reliably across multiple environments.
Running Docker may not always be a seamless experience. The docker command not found
error is a pesky error that stops you right on your track, hindering you from running Docker commands. But fret not. In this tutorial you will learn the causes of the error and how to fix it and get back on track.
#Causes of the docker command not found
error
While the error can be confounding, often causing you to second-guess your expertise in Docker, the culprits are usually the following:
Missing Docker installation: This error is likely caused by Docker not being installed on your system. On Debian/Ubuntu systems, a few commands will be printed on the terminal below the error, guiding you through installing Docker with Snap or the APT package manager.
Incorrect Docker PATH: The $PATH
environment variable lets your operating system search for executable files when you run a command. By default, Docker $PATH is automatically configured upon installation. However, If Docker is not installed in its conventional location, it may not be added to $PATH. This will cause the shell to fail to locate and execute Docker commands.
Ready to supercharge your Docker infrastructure? Scale effortlessly and enjoy flexible storage with Cherry Servers bare metal or virtual servers. Eliminate infrastructure headaches with free 24/7 technical support, pay-as-you-go pricing, and global availability.
#Fixing the Docker command not found error
To resolve this frustrating Docker error, consider adopting these fixes.
#1. Ensure Docker is installed
First, it’s prudent to check if Docker is installed in case you overlooked its installation. This can be accomplished by confirming its version.
docker version
If you get an error, then Docker is not installed. To install Docker, follow the steps outlined.
#For Debian / Ubuntu
Update the package lists.
sudo apt update
Then install Docker from the APT repositories.
sudo apt install docker.io -y
To install the latest version, install Docker from the official Docker repository.
#For RHEL-based distributions
In Red Hat distributions, start by adding the Docker repository to your system. Before you do so, enable the yum-utils
prerequisite package.
sudo yum install yum-utils
Then add the Docker repository.
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Finally, install Docker and associated packages.
sudo yum install docker-ce docker-ce-cli containerd.io -y
For RHEL and its distributions, Docker is not automatically started, unlike Debian/Ubuntu. Therefore, ensure to start the service by running:
sudo systemctl start docker
#For Arch Linux
For Arch and Arch-based distributions, update the system.
sudo pacman -Syu
Then install Docker.
sudo pacman -S docker
Confirm the version installed:
docker --version
Then start the Docker daemon.
sudo systemctl start docker
#2. Add Docker to $PATH
Once Docker is installed, ensure its $PATH
variable is configured by running the command:
which docker
By default, the expected PATH
should point to the /usr/bin/docker
binary directory.
Output/usr/bin/docker
If this output does not reflect what you have, edit the '.bashrc' file.
nano .bashrc
Configure the Docker PATH
as shown
export PATH="$PATH:/usr/bin/docker"
Exit the configuration file. Then apply the changes by reloading the configuration.
source ~/.bashrc
The error should be fixed once the PATH
is added.
#3. Restart Docker daemon
Sometimes, restarting the Docker service will clear the error. Simply run the command:
sudo systemctl restart docker
In addition, be sure to verify that the service is running:
sudo systemctl status docker
Output● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
Active: active (running) since Mon 2025-03-10 14:51:08 EET; 12min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 117565 (dockerd)
Tasks: 9
Memory: 27.2M (peak: 28.8M)
#Conclusion
Typically, Docker should run just fine if properly installed, and rarely will you encounter the docker command not found
error. But in the rare event you do, we have provided some resolutions to address it. If you faced this error, we hope you are now back on track and managing your workloads seamlessly.
Cloud VPS Hosting
Starting at just $3.24 / month, get virtual servers with top-tier performance.