Docker Community Forums

Share and learn in the Docker community.

Windows: An error occurred trying to connect

(Sbuergel) #1

Hi forum

I followed all windows install instructions from the website. I also quick-started a machine which doesnt seem to have any issues. When opening a windows command prompt I get the following:

C:\Users\sbuergel>docker version
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   76d6bc9
 Built:        Tue Nov  3 19:20:09 UTC 2015
 OS/Arch:      windows/amd64
An error occurred trying to connect: Get http://localhost:2375/v1.21/version: di
al tcp ConnectEx tcp: No connection could be made because the ta
rget machine actively refused it.

Can anyone help me with the error message on the bottom? I get this when a) having the machine open (I see a blinking linux shell) and b) also when I close that window. I also used the Oracle VM Virtual Box to delete the machine and then use the Docker Quickstart Terminal to create a new machine, the result is the same. Any help would be massively appreciated!

(Jeff Anderson) #2

If you open a new shell, you have to tell your docker client how to connect to the docker daemon that is running in the virtualbox VM.

If you open the quickstart terminal, it runs a command that sets the shell environment up so that the docker client knows how to connect.

If you open a new shell, you have to do that step on your own. For windows, you have to specify your shell type. For cmd, run the following and then paste the output back into your cmd shell:

docker-machine env --shell cmd default

or for powershell, just run the following:

docker-machine env --shell powershell default | Invoke-Expression


(Kjanshair) #3

Actually I’m confronting the same issue but couldn’t resolve it as you said. I’m using PowerShell and MSBuild. I first start the default virtual box using docker-machine start default command and then run your commands. But still getting the same error. Can you please help me to resolve this problem.

(Gfr2016) #4

Docker Toolbox Version 1.10.3 installation on Windows 7/amd64 breaks existing VirtualBox installations. E.g. VBoxManage is missing in the VirtualBox folder.
I get the same error as mentioned above and docker-machine ls tells me “VBoxManage not found…”.

(Eric Ti-Yu Chiang) #5

Maybe try deleting and recreating the default machine:

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

Another approach that might work is to open VirtualBox directly, turn off the “default” machine, then run Docker Quickstart.

I found these from this docker toolbox issue discussion. Thanks.

(Debanjanbose) #6

Thanks Jeff!
Your suggestion to set the output of “docker-machine env --shell cmd default” in the cmd window worked for me.
$ docker-machine env --shell cmd default
SET DOCKER_CERT_PATH=C:\Users\DebanjanBose2.docker\machine\machines\default
REM Run this command to configure your shell:
REM @FOR /f “tokens=*” %i IN (’“C:\Program Files\Docker Toolbox\docker-machine.exe” env --shell cmd default’) DO @%i

(Bo) #7

This helped, however I still had to run
docker-machine env --shell cmd default
@FOR /f "tokens=*" %i IN ('"C:\Program Files\Docker Toolbox\docker-machine.exe" env --shell cmd default') DO @%i
Then it ran OK

(Docmaster) #8

I didn’t help me.

I was getting the below syntax error that I couldn’t figure it out. Could you please help me

$ @FOR /f “tokens=*” %i IN (’“c:\Program Files\Docker Toolbox\docker-machine.ex
e” env --shell cmd default’) DO @%i
sh: syntax error near unexpected token `(’

(Chex) #9

This fixed my problem. Thank you!

(Mrixman) #10

I ran across this post because I was having trouble getting my windows docker client to connect (via a TLS secured socket) to an ubuntu-hosted docker daemon. Turns out I had mistyped the port number, so they didn’t match. Thought I’d leave this here in order to save somebody else the time.

(Nyendluri) #11

Thanks, this solved my issue. Btw for anyone who created docker machine manually using create command. replace ‘default’ to name of your machine.