Mohammad Heydari
Mohammad Heydari

Reputation: 4270

Windows doesn't recognize Docker command

I already installed Docker for windows. when I type docker --version command in Command prompt, it doesn't recognize it at all.

The message will be this:

'docker' is not recognized as an internal or external command,
operable program or batch file.

docker --version command in cmd

Did I miss something ?

Upvotes: 90

Views: 284663

Answers (27)

Harsha
Harsha

Reputation: 21

just restarting powershell after setting env path variable worked

Upvotes: 0

Amir Jafari
Amir Jafari

Reputation: 1

*just add in your environmental Path this syntax if you did like (install docker in c drive) me, most probably it would work, for me, this passed well. (note: if you going to call RefreshEnv.cmd or RefreshEnv through your CMC with Chocolatey, this path would not be created for you, and you have to do it manualy in Windows 10 operating system).

C:\Program Files\Docker\Docker\resources\bin

Upvotes: 0

MRAH
MRAH

Reputation: 257

2022 - Windows 11

Add these paths to the PATH variable.

C:\Program Files\Docker\Docker\resources\bin

C:\ProgramData\DockerDesktop\version-bin

Docker PATH variable Windows 11:
Docker PATH variable Windows 11

Upvotes: 8

Pouriya Babaali
Pouriya Babaali

Reputation: 43

just add this path in your "Path" inside env variables inside windows

C:\Program Files\Docker\Docker\resources\bin

then restart your gitbash or cmd or ...

everything goes well after that !

Upvotes: 1

Dwi Setyo Aji
Dwi Setyo Aji

Reputation: 123

I facing the same issue when I try to run docker -v in Vscode Terminal after install it. I try to use cmd and git bash it work fine. Restart your vscode will solve it

Upvotes: 2

SpatialNasir
SpatialNasir

Reputation: 195

In my case, I switched to the windows command prompt instead of the VScode terminal.

Upvotes: 0

djsreeraj
djsreeraj

Reputation: 719

For those who are facing docker issue on VS Code

I was trying on VS Code Terminal after installation. Restarted and was still facing issue.

enter image description here

Then I tried with fresh terminal of Command Prompt -- it worked!

enter image description here

After that it also working fine on vs code.

In VS Code - close all terminals and open fresh terminal and try test command:

docker --version

enter image description here

Upvotes: 3

Johto Robbie
Johto Robbie

Reputation: 11

  1. Download "docker-machine-Windows-x86_64.exe" from: https://github.com/docker/machine/releases
  2. Rename "docker-machine-Windows-x86_64.exe" to "docker-machine.exe".
  3. Copy "docker-machine.exe" to path C:\Program Files\Docker\Docker\resources\bin.

image

Upvotes: 0

Felix Too
Felix Too

Reputation: 11932

I noticed that running docker commands before startup causes this issue, but ensuring that docker is running and executing the commands after, they are then recognised. enter image description here

Upvotes: 1

tori_san
tori_san

Reputation: 41

I faced the same problem, them I tried in Powershell which works someHo

Upvotes: 0

Mahmoud Nasr
Mahmoud Nasr

Reputation: 642

Unfortunately, After many tries and restarts, I uninstalled docker and Re-installed it again, and I had to build all things again.

Upvotes: 0

Edwin Okoronkwo
Edwin Okoronkwo

Reputation: 91

Renaming 'com.docker.cli' to 'docker' helped me finally get windows powershell and cmd terminals to recognize the docker command.

Upvotes: 9

Prasenjit Mahato
Prasenjit Mahato

Reputation: 1294

docker: command not found

Windows 7: Just set the path of docker in system variable

Step:1 [Click on path -> edit-> paste the docker location]

enter image description here

Step:2 [Paste the docker location] In my case C:\Program Files\Docker Toolbox.

enter image description here

now check $ docker version

Upvotes: 9

Sandeep Goutam
Sandeep Goutam

Reputation: 154

I installed docker Docker version 19.03.13 build 4484c46d9d, in Windows 10 pro 1903. I was facing the same issue, then I just renamed 'com.docker.cli' to 'docker' and set the environment variable to 'C:\Program Files\Docker\Docker\resources\bin'

Problem Resolved.

Refer the image:

https://drive.google.com/file/d/1sZwx4udOzJeITV2RDGQKlsOt_TF4Wq2N/view?usp=sharing

https://drive.google.com/file/d/1DpW2DR2n_jCGezwrXuhNtXpSTBWmEDJk/view?usp=sharing

Upvotes: 12

VivekDev
VivekDev

Reputation: 25349

For me, I had to ensure the check box Enable Hyper-V Windows Features is checked as I was installing.

I just wanted to have client installed, without the engine. So earlier, as I was installing, I unchecked that option. And after successful installation, I get the error - windows does not recognize docker.

But now that reinstalled with the checkbox checked, things are working fine now.

Enable Hyper-V Windows Features

Upvotes: 1

vinay k hegde
vinay k hegde

Reputation: 253

Just Restart the system, it is always good practice to restart the system when you install or uninstall any application. Hope this works :)

Upvotes: 2

Naveen
Naveen

Reputation: 11

I also face a problem with the installation and running docker. I'm not sure you how did you install docker. I tried this way. I've downloaded the docker toolbox (https://github.com/docker/toolbox/releases) which comes up with docker,docker-machine. Oracle Virtual box which is pretty much enough to start docker locally.Please make sure you have git bash installed in your local. Once the toolbox installation is done click the icon generated on the desktop . Make sure this icon target to your Git bash.exe (you can verify this by right click on icon and find target). and verify docker version

Upvotes: 1

Aashman Thing
Aashman Thing

Reputation: 302

If you have installed Docker Toolbox in your windows, go and add the environment variable.

PATH = "location of folder that contains docker-machine"

Upvotes: 1

tushar mathur
tushar mathur

Reputation: 11

Try to install GIT bash and then run this command on it for Windows:

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"

Click Here.

there is some issues with PowerShell or new version of docker due to which I was facing the same issue but then I went to this page and got way to run it.

PS: GIT bash is required.

Upvotes: 1

gurkanindibay
gurkanindibay

Reputation: 101

I checked environment variables and noticed that docker path is as the following path in which "R" in resources uppercase. I fixed the case and everything worked as expected Path: "C:\Program Files\Docker\Docker\Resources\bin"

Upvotes: 2

Sudheer Muhammed
Sudheer Muhammed

Reputation: 893

You need to restart the system after installation. It worked for me.

Upvotes: 1

learnerplates
learnerplates

Reputation: 4387

Run as administrator worked for me, both powershell and bash on windows. I did not need to restart.

Upvotes: 4

Radha
Radha

Reputation: 81

Make sure the docker.exe path (C:\Program Files\Docker\Docker\resources\bin) is added to the PATH variable.

You can check it as follows:

ECHO %PATH%

The docker path had to be appended at the end of the PATH in my case. After that docker cmd was recognized.

Upvotes: 5

Rajesh
Rajesh

Reputation: 4759

I had installed Docker 18.06.1-ce version on my Windows 10 machine and faced the similar issue, even though the docker was added the Windows %PATH%.

I moved the docker path to the bottom and that solved my problem.

enter image description here

enter image description here

Upvotes: 97

mastercoder8
mastercoder8

Reputation: 67

Add docker to PATH variable & refreshenv to keep using the same command prompt


If you've installed using docker toolbox the install path "C:\Program Files\Docker Toolbox"

Manually using Environmental Variable > Path (add docker path here)


Using Command Line

For temporary use set PATH=%PATH%;C:\Program Files\Docker Toolbox

  • Make sure to take a back up of PATH by echo %PATH% before doing this

For permanent change setx PATH=%PATH%;C:\Program Files\Docker Toolbox

Upvotes: 7

Arijit Panda
Arijit Panda

Reputation: 1665

You need to start the docker first if you have not and then open powershell.

In the powershell, try to run docker commands.

Upvotes: 18

Mohammad Heydari
Mohammad Heydari

Reputation: 4270

I restarted the system, it worked, maybe we can say that a restart is required.

Upvotes: 74

Related Questions