我有一个要在Ubuntu服务器上使用Docker部署的Rails应用程序。我已经为应用程序设置了Dockerfile,现在我想查看其容器中的conf。nginx
我运行以下命令以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.
我已经很好地检查了它与网络连接无关。我需要一些帮助。谢谢。
这是我解决的方法:
以交互方式启动应用程序的docker容器,在我的情况下,它是一个nginx
容器:
docker run -i -t nginx:latest /bin/bash
运行以下命令以授予对该文件角色的read
权限:others
resolv.conf
chmod o+r /etc/resolv.conf
注意:如果在主机(Ubuntu Linux OS)上而不是在Docker容器上遇到此问题,请sudo
在主机终端中运行添加到它的相同命令:
sudo chmod o+r /etc/resolv.conf
运行此命令后,请尝试退出bash交互式终端:
exit
然后打开一个新的bash交互式终端并再次运行命令:
apt-get update
apt-get install nano
export TERM=xterm
现在一切正常。
在Digital Ocean上对此的引用:Apt错误:解决“ deb.debian.org”的临时故障
就这样。
我希望这有帮助