In this article we will consider a problem related to Docker, which gives the error ‘docker not found’, ‘docker compose not found’, ‘docker command not found’ and others. It is mostly related to either incorrect installation and missing paths in environment variables to the file, or incorrect use of the command.
How to quickly run a check and fix Docker not found error? Let's go through the checklist in order and in the process we will be able to identify the source of the problem!
Absence of needed packet
This error can occur when there is no software installed on the machine - make sure you have it. For Ubuntu and Linux-like distributions, you can check via the command:
apt list | grep 'docker' | grep 'installed'
For Windows, you need to use the terminal utility Win+X → Terminal/PowerShell → winget:
winget list | Where-Object { $_ -match 'Docker' }
The command will list the installed software and the filter command will find mentions of Docker. If the required applications are missing, install them by specifying the installation package on Windows:
winget install Docker.DockerDesktop
Or for Ubuntu and Linux-like operating systems you should use:
apt install docker.io docker-compose -y
Remove any unnecessary software from the command above that doesn't suit you, the remaining dependencies will be listed in the package and downloaded automatically.
Incorrectly invoked application
Not always the commands to work for utilities and software are called the same, often it can be different commands or missing permissions on it. For example, reboot on Linux:
This is why you need to run commands as Administrator, in Linux check that you have sudo rights:
sudo -l
If you are not there, add rights by running the command as root, first replace user with your login:
usermod -aG sudo user && sudo docker
In Windows, run Win+X → Terminal/PowerShell (Administrator) → docker. If this solution does not work, then use the command guides:
apt show docker-ce
Or for Windows you need to use the command:
winget show Docker.DockerDesktop
Where you can go to the package developer's site and find the command you need, but for Docker it is the same name, i.e. the docker command.
No entry in environment variables
To realise the solution to this problem let's write a new path to the folder with Docker on Linux and Windows, for this purpose find the place where the executable file lies:
grep -r / 'docker'
And in Windows classically search by folder via Win+E → Search, then copy the path found and for Linux write:
echo 'PATH=$PATH=$PATH:/home/user/docker' | sudo tee /etc/environment
For Windows, open a search on the Win key and type ‘Environments’ or ‘Variables’ where you select the desired one:
Once again, select Environment Variables and type in your own or in the system environment variable parameter:
And write a new path there, after which we will restart the device and check if it works!
Great, the software is running and ready to work! These steps should solve the main causes of this problem, they are also suitable for other software!
As a result of executing these commands you should get a list of parameters of the requested objects. If you don't have sufficient resources than you can perform actions on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.