Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker commands fails (in Windows)

Tags:

docker

I am trying to use Docker on a windows machine and is hit with every possible issue it seems. My latest one is this: My machine is running but I can't seem to interact with it using the docker commands. If I run a very standard command like:

docker ps 

I get an error message like this:

An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v 1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified. 

So apparently some path is all messed up. Do anyone know which path this is and how to fix this?

like image 410
jimmy Avatar asked May 30 '16 14:05

jimmy


People also ask

Does Docker CLI work with Windows?

So is there an alternative on Windows to continue to legally use containers with a docker command and a nice UI like VSCode without paying a licence : the answer is YES ! We are doing magic with Windows 10, Ubuntu on WSL2, docker builder cli for windows and a little elbow grease.

Is WSL2 required for Docker?

However, since WSL 2 now runs on a Linux kernel with full system call capacity, Docker can fully run in WSL 2. This means that Linux containers can run natively without emulation, resulting in better performance and interoperability between your Windows and Linux tools.


2 Answers

Edit (2021) - This answer is for the old Docker Toolbox, not Docker Desktop.

When running docker ps and receiving:

An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

The following environment properties need to be set:

 set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default  set DOCKER_HOST=tcp://192.168.99.100:2376  set DOCKER_MACHINE_NAME=default  set DOCKER_TLS_VERIFY=1 

This is assuming the %USERPROFILE%\.docker\machine\machines\default is default path where the cert.pem, key.pem, ca-key.pem, and ca.pem docker files are; the virtual machine name's (created by docker-machine create) is default and Virtual Box DHCP Server's lower bound (found under VirtualBox->File->Preferences->Network->Host-only Networks->hover mouse on VirtualBox Host-Only Ethernet Adapter) is 192.168.99.100 and no other VM is running in VirtualBox.

like image 196
jan.supol Avatar answered Nov 02 '22 01:11

jan.supol


Same issue here on Win 7. Solution:

In the Docker Quickstart window, at the $ prompt run the below line:

your_user@your_machine MINGW64 ~

$ eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)

Then, you'll be able to run "docker run hello-world".

like image 32
r590 Avatar answered Nov 02 '22 00:11

r590