Apt-get time out on docker-container

General information:
I have a docker container running on Ubuntu 18.04.1 LTS.
The Container itself runs on ubuntu aswell.
I’m behind a corporate proxy.

Problem:
When I try to run “apt-get update” I get a “connection timed out” error every time.
When I try to ping a ip, it just gets stuck and doesnt respond.

What I tried:

  • edited the /etc/default/docker for DNS and proxy
  • edited /etc/systemd/system/docker.service.d/http-proxy.conf

I have full internet-access on my host maschine. When I run apt-get update or any other command on the docker container, it recognizes the ip of the service but then just times out.

==> Running the quorum-maker (https://github.com/synechron-finlabs/quorum-maker#setting-up-quorum-network-on-multiple-machines)

Hope someone can help.

1 Like

Did you launch the container with Docker networking enabled?

I’m not sure what you mean by, ‘it recognizes the ip of the service.’ Are you saying it properly resolves DNS?

I have same problem now.

vagrant1337, do you fix it?

Huff!

I solve my problem by:
RUN echo ‘Acquire::http::Proxy “http://proxy…:80”; Acquire::https::Proxy
http://proxy…:80”;’ >> /etc/apt/apt.conf.d/httpproxy

inside Dockerfile.

Hi,

same problem here.
I’m behind a corporate proxy. The host system is able to reach the Internet via proxy and custom DNSs.
So, based on what I find in the official documentation, these are the steps I did:

  • Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf and inserted the Proxy configuration
  • systemctl daemon-reload && systemctl restart docker
  • systemctl show --property=Environment docker shows that the new Proxy variable correctly set
  • I also configured the corporate DNS IPs in /etc/docker/daemon.json to make sure the proxy is resolved within the container

After that, I wanted to test if the Internet connection works within a container:
docker run -it ubuntu bash and try to perform an apt-get update

root@2496ee44ee0c:/# apt-get update
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Could not connect to proxy.corporate.com:8080 (10.0.0.1), connection timed out
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not connect to proxy.corporate.com:8080 (10.0.0.1), connection timed out
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Unable to connect to proxy.corporate.com:8080:
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Unable to connect to proxy.corporate.com:8080:
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not connect to proxy.corporate.com:8080 (10.0.0.1), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Unable to connect to proxy.corporate.com:8080:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Unable to connect to proxy.corporate.com:8080:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not connect to proxy.corporate.com:8080 (10.0.0.1), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

If I type env I can see the HTTP_PROXY and http_proxy variables are both set and the /etc/resolv.conf file shows the DNS used by the corporate.

I have also set net.ipv4.ip_forward=1 on my Centos 7 installation, but no luck with it. There’s no way to reach the proxy from within the container. Please help.