Hot Summer Sale - up to 36% OFF

How to Fix the Docker Command Not Found

How to Fix the Docker Command Not Found
Published on Jun 13, 2025 Updated on Jun 13, 2025

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.

Command Line
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.

Command Line
sudo apt update

Then install Docker from the APT repositories.

Command Line
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.

Command Line
sudo yum install yum-utils

Then add the Docker repository.

Command Line
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Finally, install Docker and associated packages.

Command Line
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:

Command Line
sudo systemctl start docker 

#For Arch Linux

For Arch and Arch-based distributions, update the system.

Command Line
sudo pacman -Syu

Then install Docker.

Command Line
sudo pacman -S docker

Confirm the version installed:

Command Line
docker  --version

Then start the Docker daemon.

Command Line
sudo systemctl start docker 

#2. Add Docker to $PATH

Once Docker is installed, ensure its $PATH variable is configured by running the command:

Command Line
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.

Command Line
nano .bashrc

Configure the Docker PATH as shown

Command Line
export PATH="$PATH:/usr/bin/docker"

Exit the configuration file. Then apply the changes by reloading the configuration.

Command Line
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:

Command Line
sudo systemctl restart docker

In addition, be sure to verify that the service is running:

Command Line
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.

Share this article

Related Articles

Published on Aug 8, 2024 Updated on Oct 25, 2024

How to Push Docker Image to Docker Hub

Learn how to create a Docker hub repository and push an image to the Docker hub using the `docker push command` in this detailed tutorial.

Read More
Published on Sep 4, 2024 Updated on Nov 7, 2024

How to List Docker Images: A Complete Guide to Managing All Images

Learn how to list Docker images, analyze and filter them efficiently. This complete guide covers commands, flags, and tips for managing all your Docker images effectively.

Read More
Published on Dec 19, 2023 Updated on Jan 24, 2025

Docker Commands Cheat Sheet [With Examples]

This Docker commands cheat sheet will cover all the basic Docker commands you need to know to streamline your development workflow.

Read More
We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: 8673954a8.1237