Beginner having trouble with docker behind company proxy

since you have configured cntlm to listen to all your host’s IPs, you can connect to something other than 127.0.0.1.

Here’s an overview of the typical virtualbox networking setup (skip to the end if you want a tldr):

Say my laptop running virtualbox and cntlm has three IPs: 127.0.0.1 (lo0), 192.168.10.55 (en0), and 192.168.99.1 (vboxnet1). The exact IPs and interface names will vary with the exact setup, so double check yours using ifconfig.

My boot2docker VM is running as well, but it has its own network stack. In addition to the VM having its own 127.0.0.1 (lo), it’ll have another address like 10.0.2.15 (eth0), and 192.168.99.100 (eth1).

The eth0 on the VM is running with a virtualbox “NAT mode” network. From the point of view of my host, any connections coming through this interface just look like the virtualbox process on the host are making them directly. From the point of view of the VM, it’s a network with a gateway ip (10.0.2.2). I can double check this by looking at the default route by running the route command from inside the VM. The boot2docker VM will direct all its traffic through this interface by default.

The eth1 on the VM is running a “host only network”. There is no router/gateway configured on this interface. essentially the virtual interface in the VM is bridged with the vboxnet1 interface on my host. This is the IP that is returned if you run the docker-machine ip default command.


So, if I’m on the VM, and I want to reach the host, I have two main options.

  • I can connect to the host’s real ip on the network (192.168.10.55 on en0 in the above example).
  • I can connect to the host’s ip on the vboxnet1 interface (192.168.99.1) using the host-only networking mode.

The reason that you are getting connection refused still is that the VM still has its own 127.0.0.1, and any time you connect to 127.0.0.1 you are connecting to yourself-- the VM in this case.


tldr; probably HTTP_PROXY=http://192.168.99.1:3128/ will work.

3 Likes