Docker build “Could not resolve 'archive.ubuntu.com'” apt-get fails to install anything

后端 未结 15 2164
日久生厌
日久生厌 2020-11-28 17:45

I\'ve been trying to run Docker build on various files which previously worked before, which are now no longer working.

As soon as the Docker file included any line

15条回答
  •  甜味超标
    2020-11-28 18:35

    Same issue for me (on Ubuntu Xenial).

    • docker run --dns ... for containers worked.
    • Updating docker daemon options for docker build (docker-compose etc.) did not work.

    After analyzing the docker logs (journalctl -u docker.service) if found some warning about bad resolvconf applied.

    Following that i found that our corporate nameservers were added to the network interfaces but not in resolvconf.

    Applied this solution How do I configure my static DNS in interfaces? (askubuntu), i.e. adding nameservers to /etc/resolvconf/resolv.conf.d/tail

    After updating resolvconf (or reboot).

    bash docker run --rm busybox nslookup google.com

    worked instantly.

    All my docker-compose builds are working now.

提交回复
热议问题