Docker 构建“无法解析‘archive.ubuntu.com’"apt-get 无法安装任何东西 [英] Docker build "Could not resolve 'archive.ubuntu.com'" apt-get fails to install anything

查看:30
本文介绍了Docker 构建“无法解析‘archive.ubuntu.com’"apt-get 无法安装任何东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在以前工作的各种文件上运行 Docker 构建,现在不再工作.

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

只要 Docker 文件包含要安装软件的任何行,它就会失败并显示一条消息,提示未找到该软件包.

As soon as the Docker file included any line that was to install software it would fail with a message saying that the package was not found.

RUN apt-get -y install supervisor nodejs npm

出现在日志中的常见消息是

The common message which showed up in the logs was

Could not resolve 'archive.ubuntu.com'

知道为什么无法安装任何软件吗?

Any idea why any software will not install?

推荐答案

经过一番头痛,我找到了答案.无法解析 'archive.ubuntu.com' 可以通过进行以下更改来修复:

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

  1. /etc/default/docker
    中取消注释以下行DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

重启Docker服务sudo service docker restart

删除所有缓存了无效 DNS 设置的图像.

Delete any images which have cached the invalid DNS settings.

归功于 Andrew SB

这篇关于Docker 构建“无法解析‘archive.ubuntu.com’"apt-get 无法安装任何东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆