Docker on a linux VMware machine: error with apt-get and proxy
You may be in a corporate network I assume and you need to make two changes.
$ cat /etc/resolv.conf# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTENnameserver 10.X.Y.Zsearch myorg.org
You need to setup these in your docker daemon config. You can do this by creating a file /etc/docker/daemon.json
with below content
{ "dns": ["10.X.Y.Z"], "dns-search": ["myorg.org"]}
The actual values will depend on the output you got.
You also need to change the proxy settings and apply them in your docker service drop-in file. This can be done as listed in below thread
lookup registry-1.docker.io: no such host (Same as what VonC already pointed out)
Adding ENV
to your Dockerfile is not needed at build time: during a docker build, the only one needing a proxy is the docker daemon.
See "Control Docker with systemd", especially the section "HTTP/HTTPS proxy"
/etc/systemd/system/docker.service.d/http-proxy.confEnvironment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporatio
Followed by:
$ sudo systemctl daemon-reload$ sudo systemctl restart dockerVerify that the configuration has been loaded:$ systemctl show --property=Environment dockerEnvironment=HTTP_PROXY=http://proxy.example.com:80/