Docker Community Forums

Share and learn in the Docker community.

Cannot run apt-get update successfully behind proxy (Beta 13.1)


(Malte Breuer) #1

Situation

After installing beta 13.1 running docker pull works flawlessly behind a proxy. However, inside a container proxy settings are not propagated properly.

Expected behavior

apt-get runs successfully (pulls updates, installs updates)

Actual behavior

apt-get cannot connect

root@98fd36bf76b4:/# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Ign:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Ign:4 http://archive.ubuntu.com/ubuntu xenial Release
Ign:5 http://archive.ubuntu.com/ubuntu xenial-updates Release
...
Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
Err:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Err:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Err:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Err:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Err:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Err:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Err:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Err:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
Err:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
Err:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
Reading package lists... Done
W: The repository 'http://archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://archive.ubuntu.com/ubuntu xenial-security Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/main/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/restricted/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/restricted/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/restricted/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/main/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/restricted/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/universe/source/Sources  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/main/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/restricted/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/universe/binary-amd64/Packages  Cannot initiate the connection to 8080:80 (0.0.31.144). - connect (22: Invalid argument)
E: Some index files failed to download. They have been ignored, or old ones used instead.

Information

Proxy settings in System Preferences

Proxy settings inside container

root@3ed2f727b6a8:/# set | grep proxy
HTTPS_PROXY=proxy.company.com:8080
HTTP_PROXY=proxy.company.com:8080
http_proxy=proxy.company.com:8080
https_proxy=proxy.company.com:8080

Notice that apt-get needs the proxy to be configured as http://proxy.company.com:8080.

Pinata

OS X: version 10.11.5 (build: 15F34)
Docker.app: version v1.11.1-beta13.1
Running diagnostic tests:
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x

Steps to reproduce the behavior

  1. Run `docker run -it ubuntu bash``
  2. Run apt-get update

(Dave Tucker) #2

Thanks for the report. This is being tracked on issue (#3526). I’ve got a fix pending and hope that it should be available in the next beta!


(Sgeisbacher) #4

in which github-repository can i find that issue #3526. can you provide a link? i’ve looked in hyperkit, docker, libcompose, compose, … but i did not find that issue


(Vdweij) #5

I’m experiencing the same issue. Can download and run Docker images, but a running container cannot connect to the outside world.

http_proxy and https_proxy are both set but apt-get update fails.

From the container I can ping the host (docker daemon), but not the proxy server.

Running Docker version 1.13.1, build 092cba3 on Ubuntu 16.04

Any suggestions?


(Vdweij) #6

Solved for me. DNS setting were wrong for my environment. The company firewall blocks dns lookup to google’s dns (8.8.8.8)
When starting the container with -dns=ip-of-company-dns nslookups were successful and the container could resolve the ip of the proxy server.

All that is left for me is to find a nice global way to tell docker to start all containers with a custom dns configuration.

Adding a /etc/docker/daemon.json to my host with works:

{
  "dns" : [
    "company_ip1",
    "company_ip2",
    "8.8.8.8",
    "8.8.4.4"
  ]
}

Adding the dns to /etc/default/docker does not get picked up as stated in the file.


(Leeyuiwah) #7

Hi, I have the same issue now. I tried the DNS solution proposed by vdweij, but it did not work for me.

Do you guys found a solution by now?

Where can I find the said issue #3526?


(Leeyuiwah) #8

I now found a solution to my problem. It is documented here


(Yicone) #9