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

后端 未结 15 2163
日久生厌
日久生厌 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:22

    After much headache I found the answer. Could not resolve 'archive.ubuntu.com' can be fixed by making the following changes:

    1. Uncomment the following line in /etc/default/docker
      DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

    2. Restart the Docker service sudo service docker restart

    3. Delete any images which have cached the invalid DNS settings.

    4. Build again and the problem should be solved.

    Credit goes to Andrew SB

提交回复
热议问题