我有一个 Rails 应用程序,我想在 Ubuntu 服务器上使用 Docker 部署它。我已经为应用程序设置了 Dockerfile,现在我想在其容器中查看 nginx
conf。
我运行以下命令以交互模式启动 nginx
容器:
docker run -i -t nginx:latest /bin/bash
现在我正在尝试安装 nano
编辑器,以便使用以下命令查看 nginx
配置( nginx.conf
)的配置:
apt-get update
apt-get install nano
export TERM=xterm
但是,当我运行第一个命令 apt-get update
时,我收到以下错误:
Err:1 http://security.debian.org/debian-security buster/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
我检查得很好,它与网络连接无关。我需要一些帮助。谢谢你。
原文由 Promise Preston 发布,翻译遵循 CC BY-SA 4.0 许可协议
这是我解决它的方法:
以交互模式启动应用程序的 docker 容器,在我的例子中是
nginx
容器:运行以下命令,将
read
resolv.conf
文件的others
角色:注意:如果您在主机(Ubuntu Linux OS)而不是 Docker 容器上遇到此问题,则在主机终端中运行相同的命令添加
sudo
到它:运行此命令后,努力退出 bash 交互式终端:
然后打开一个新的 bash 交互式终端并再次运行命令:
现在一切都应该正常了。
在 Digital Ocean 上对此的参考: Apt 错误:解决“deb.debian.org”的临时故障
就这样。