Docker build says network times out, but "wget" to same URL returns data immediately

On CentOS7.2, I have Docker 1.12 installed. I have a very trivial Dockerfile (just the “FROM” so far). I’m just trying to run “docker build” to see what it produces.

The following is repeatable output from the same series of commands:
$ docker build src/docker Sending build context to Docker daemon 3.072 kB Step 1 : FROM tomee:8-jdk-7.0.0-webprofile Pulling repository docker.io/library/tomee Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/tomee/images. You may want to check your internet connection or if you are behind a proxy. $ ping www.cnn.com PING prod.turner.map.fastlylb.net (151.101.40.73) 56(84) bytes of data. 64 bytes from 151.101.40.73: icmp_seq=4 ttl=50 time=37.0 ms 64 bytes from 151.101.40.73: icmp_seq=10 ttl=50 time=37.5 ms 64 bytes from 151.101.40.73: icmp_seq=11 ttl=50 time=37.3 ms C-c C-c --- prod.turner.map.fastlylb.net ping statistics --- 12 packets transmitted, 3 received, 75% packet loss, time 11012ms rtt min/avg/max/mdev = 37.085/37.333/37.555/0.192 ms $ wgetcat https://index.docker.io/v1/repositories/library/tomee/images [{"checksum": "", "id": "4361979445aa89355dd869817f2b3f02c09b30b03164c6bd3c17dcfc75c1e1a0"}, {"checksum": "", "id": "22e49adff72d0c667a5e69267f5dd5a1427399fdec8477f899f649bd39eb9265"}, {"checksum": "", "id": "e73194efeca29fc14ed7b50a4508dde62bcbde70fadcc0ae4dec9e6b58cbc798"}, {"checksum": "", "id": "012f7ae619c99e0058b7b689106dcde1ec7b94c1dfcd0b3489f0e0db9a939ca1"}, {"checksum": "", "id": "1bab967

The “wgetcat” script is a simple wrapper on “wget” that just prints the output to stdout.

As you can see, I have no trouble reaching the internet, or even reaching the exact URL that Docker complains it can’t reach. I’ve run this same series of tests multiple times, with the same result.

Note that when I first ran this build, it was while I was behind a corporate firewall. This firewall blocks access to docker.io, so I had to run this build outside of the firewall (I’m working on getting access to an internal mirror of docker.io).

It looks like this happened because of proxy issues. I said at the time I was running this that I wasn’t behind a proxy, but I still need env vars saying that I was behind a proxy. I was able to get this to work behind the proxy by reconfiguring the daemon to use the proxy.