14

Installed Docker on Windows with 2 additional installs, Oracle VM VirualBox and Kitematic. I've disabled Hyper-V in my Windows 10 PC. Now the problem is I can't download any Docker images from DockerHub, not even I can run the command as

Docker info

At both ends it shows the following error.

An error occurred trying to connect: Get http://localhost:2375/v1.21/info: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.

If I run it in Docker QuickStart Terminal it works, but not working in PowerShell or in MSBuild.

1

7 Answers 7

24

If you are using windows command prompt instead of Docker QuickStart Terminal see official docs you should make following steps (assuming your docker machine has the name default):

  1. docker-machine start default or create new one
  2. docker-machine lswill show you your machine running
  3. docker-machine env --shell cmd default and you'll see something like

    SET DOCKER_TLS_VERIFY=1
    SET DOCKER_HOST=tcp://192.168.99.100:2376
    SET DOCKER_CERT_PATH=C:\Users\Arseny\.docker\machine\machines\default
    SET DOCKER_MACHINE_NAME=default
    REM Run this command to configure your shell:
    REM     FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO %i
    
  4. Run FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO %i
  5. Enjoy
4
  • 2
    Please let me know one thing, that when I run the command at the 4th point. It works fine on that instance. But when I restart the terminal I've to renter the given command. How do I set the permanent shell for Docker? Thanks Commented Feb 9, 2016 at 14:14
  • I'm not actually sure if the IP of DOCKER_HOST=tcp://192.168.99.100:2376 is stable in each docker-machine start default. I'd make the script which does all commands in a batch (what actually Docker QuickStart Terminal does, I assume). You can take a look at the shell script attached to the Docker QuickStart Terminal shortcut. Don't think the comment is quite helpful :) just a hint. Commented Feb 11, 2016 at 17:59
  • I have been getting same problem on Windows 10. However when I follow steps 1-5 above, at step 2 the cmd has not come back with a response. I tried multiple times but no success. What could be the reason? Commented Apr 27, 2016 at 12:07
  • Thanks, this saved me some time!
    – isntn
    Commented Nov 5, 2016 at 17:47
1

If you want to use PowerShell (in Windows 7) instead of Docker Quickstart Terminal then enter following commands step by step in your powershell terminal:

NOTE: You must have to start Docker Quickstart Terminal first before performing below operations

docker-machine.exe env --shell powershell it will display below commands on terminal:

$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\pratikpat\.docker\machine\machines\default"
$Env:DOCKER_MACHINE_NAME = "default"
# Run this command to configure your shell:
# & "C:\Program Files\Docker Toolbox\docker-machine.exe" env --shell powershell | Invoke-Expression

Execute last displayed command to configure your shell:

& "C:\Program Files\Docker Toolbox\docker-machine.exe" env --shell powershell | Invoke-Expression
1

I got same error on Windows 7 inside Docker Terminal. So I had to do the following. In case somebody like me is searching for this.

$ docker-machine rm default
$ docker-machine create --driver virtualbox default
0

When it happened to me I was a secondary user, in other words Docker installed under a different account. So I tried [re]creating the machine as Admin:

C:\WINDOWS\system32>docker-machine create --driver "hyperv" default Creating CA: C:\Users\nonAdmin\.docker\machine\certs\ca.pem Creating client certificate: C:\Users\nonAdmin\.docker\machine\certs\cert.pem Running pre-create checks... (default) Image cache directory does not exist, creating it at C:\Users\nonAdmin\.docker\machine\cache... (default) No default Boot2Docker ISO found locally, downloading the latest release... (default) Latest release for github.com/boot2docker/boot2docker is v1.12.3 (default) Downloading C:\Users\nonAdmin\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.12.3/boot2docker.iso... (default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Creating machine... (default) Copying C:\Users\nonAdmin\.docker\machine\cache\boot2docker.iso to C:\Users\nonAdmin\.docker\machine\machines\default\boot2docker.iso... (default) Creating SSH key... (default) Creating VM... (default) Using switch "DockerNAT" (default) Creating VHD (default) Starting VM... (default) Waiting for host to start... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available...

Sadly, it did not work. Even running docker in an Admin shell fails.

0

you can solve problem on docker dekstop to;

Under Settings->General do you have Expose daemon on tcp://localhost:2375 without TLS enabled? You need to if you want to access the daemon as described.

0

All I got to do was to run

docker-machine env --shell cmd default

and then

eval "$(boot2docker shellinit)"
0

This answer is exclusively for those, who are completely new to Docker, and are using Windows 10 OS. I am supposing that you've not installed Docker Desktop previously.

Step 1 : Go to Docker Website, this link

Step 2 : Download Docker Desktop for Windows

Step 3 : Run the downloaded .exe file

Step 4 : Let it install and restart your system

Step 5 : Follow the tutorial, as they say, it'll give you an idea about Docker

Step 6 : At Last Sign up for a Docker hub Personal account

See descriptive image

Step 7 : Restart PowerShell and run docker-compose up

Not the answer you're looking for? Browse other questions tagged or ask your own question.