Bannatyne84
Bannatyne84

Reputation: 156

Docker VM host on Windows 7 behind corporate proxy cannot contact proxy or wider internet

Welcome to another slightly different flavour of "docker-machine behind corporate proxy".

I'm fairly sure this isn't an exact repeat of other questions on this subject area, having spent an exhaustive amount of time trying other potential solutions found here to no avail, but since I'm absolutely stumped, here we go...

The symptom:

root@default:/home/docker# docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: 
proxyconnect tcp: dial tcp: lookup dev-webaccess on 10.0.2.3:53: no such host.
See 'docker run --help'.

This looks like it is trying to resolve my proxy (dev-webaccess) inside the VM and failing. It also seems I cannot ping anything outside the VM. It feels like this is a bad network configuration in the VM as traffic can't get out, but I'm unsure exactly what the problem could be.

How I got here:

  1. Install Docker Toolbox 18.03.0-ce on Windows 7 with VirtualBox + NDIS6 driver
  2. Add proxy environment variables to Docker Toolbox's start.sh, used by the Docker Quickstart Terminal: start.sh

  3. Start the quickstart terminal. This seems to go fine: enter image description here The proxy details also make it into the config.json for the default machine: enter image description here

  4. Then, after doing eval $(docker-machine env default), we can ssh into the default machine: enter image description here

  5. And then if we try docker run hello-world, the fun begins: enter image description here

Here's the output of route in default-machine: enter image description here

So here, finally, is the question: Is there anything about the proxy or network configuration shown here that would explain why traffic cannot get out of the virtualbox default-machine to my proxy and the wider internet? It looks, through my non-networky eyes, as though traffic tries to leave the VM over eth0 and can't go anywhere at all.

I would be delighted to be told I'm an idiot and have missed something blindingly obvious here...

Upvotes: 1

Views: 794

Answers (1)

Bannatyne84
Bannatyne84

Reputation: 156

I appear to have resolved this issue, although I can't pretend to know precisely why this resolved it. Was a little surprising actually, just a forlorn "I'll try anything at this point" change that I read about here https://github.com/docker/machine/issues/2418

In C:\Users\user.name\.docker\machine\machines\default\config.json I had the following:

"HostOptions": {
    "Driver": "",
    "Memory": 0,
    "Disk": 0,
    "EngineOptions": {
        "ArbitraryFlags": [],
        "Dns": null,
        "GraphDir": "",
        "Env": [
            "HTTP_PROXY=http://user.name:password@dev-webaccess:8080",
            "HTTPS_PROXY=https://user.name:password@dev-webaccess:8080"
        ],

I just removed the explicit protocols (http://, https://), did a docker-machine provision default and voila! My VM works like a dream:

"HostOptions": {
    "Driver": "",
    "Memory": 0,
    "Disk": 0,
    "EngineOptions": {
        "ArbitraryFlags": [],
        "Dns": null,
        "GraphDir": "",
        "Env": [
            "HTTP_PROXY=user.name:password@dev-webaccess:8080",
            "HTTPS_PROXY=user.name:password@dev-webaccess:8080"
        ],

If anyone can explain why that proved to be the fix, I'd love to know.

Upvotes: 2

Related Questions