apt-get in docker behind corporate proxy

后端 未结 4 900
北恋
北恋 2021-02-14 18:48

I\'m attempting to set up a development environment behind a corporate proxy server with Docker. Try as I might, I cannot get the docker container to talk to the proxy server.

4条回答
  •  面向向阳花
    2021-02-14 19:09

    The issue ended up being with DNS. Docker is running on Ubuntu, which is, itself, a Guest OS on VirtualBox. Due to it's own virutalizing mumbo jumbo, it assigned a nameserver of 127.0.0.1 in resolv.conf.

    When this happens, Docker will assign itself a DNS nameserver of 8.8.8.8 (google's nameserver) since localhost refers to the docker container not the host.

    To fix this, I went all the way out to Windows and ran

    ipconfig /all
    

    And got the IP address of my laptops DNS Servers. I added these to DOCKER_OPTS in the configuration file with --dns=my.dns.ip.address and restarted docker, and the other measures I took to get through the proxy worked fine.

提交回复
热议问题