Cannot run Hello World | No connection can be made because the target


I’m just getting started with Docker and attempted to follow the install instructions to the T.

Win7 x64
Virtualization enabled & tested with the MS tool
Never had any docker tools installed before today.
The only thing I installed was the docker toolbox

Attempt to run hello world failed.

$ docker run hello-wolrd
An error occurred trying to connect: XXXXXXXXXXX_2375/v1.21/containers/create: dial tcp 127.0.tEx tcp: No connection could be made because the target machine actively refused it.

I also read this where the user has a similar issue.

I ran docker version … RESULTs

$ 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 XXXXX_ocalhost:2375/v1.21/version: dial tcp ConnectEx tcp: No connection could be made because the target machine actively refused it.

Any advice would be hugely appreciated. Based on the output it appears the server is not running, just the client. I don’t think I missed any steps. I’m just barely getting started.




To fix the issue I did the following:

  1. Uninstall both Docker Toolbox and Virtual Box and Git
  2. Remove folders .docker and .VirtualBox under folder c:\Users{windows account username}\
  3. Remove all “VirtualBox Host-Only Ethernet Adapter” from Device Manager window
  4. Restart machine
  5. Re-install Docker Toolbox WITH “RUN AS ADMINISTRATOR” enabled.
  6. Click Docker Quick Start Terminal

It is working now. The only difference seems to be running the setup as a full admin, something I never usually need to do in Windows 7.

Generally this error happens if your shell does not have the environment variables that tell your docker client how to connect to the docker service.

It is entirely possible that something went wrong during your first installation attempt, and the virtualbox docker vm wasn’t 100% set up and running, causing there to be nothing to configure your shell for in the quickstart terminal.

Glad you got it working. :slight_smile:

This exception message says you’re trying to connect to the same host ( ), while you’re stating that your server is running on a different host. This represents a ‘loopback’ . It allows the computer to communicate with itself via network protocol .

Dns.GetHostEntry(IPAddress.Loopback).HostName returns the host name of your machine. When you pass a host name to TcpClient , it will resolve it to one or more IP addresses using Dns.GetHostAddresses(hostName) . This includes the public and local IP addresses of your machine (e.g., but not (loopback address). So your client is trying to connect to any of the non-loopback addresses of your machine, while your server is listening only on the loopback address . So, no connection can be established. The solution to this problem is that connect to the same end point your server is listening on.