Ubuntu中docker容器运行apt-get update失败 Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease

在用virtualbox安装的Ubuntu上运行docker容器,在容器中使用apt-get update一直报错,

Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'

在网上找了很多解决方案都没成功,自己最后通过查看Ubuntu虚拟机网络中DNS,将DNS配置到Docker 中/etc/resolv.conf文件中,成功运行apt-get update

查看cat /etc/resolv.conf配置文件

cat /etc/resolv.conf

查看Ubuntu虚拟机上system网络中的DNS

将该DNS写入到docker运行容器中DNS文件

echo "nameserver 150.236.34.180" | tee /etc/resolv.conf > /dev/null
root@29031ce31df6:/# cat /etc/resolv.conf
nameserver 150.236.34.180

运行apt-get update

apt-get update




sudo apt update Hit:1 https://mirrors.aliyun.com/debian bookworm InRelease Hit:2 https://mirrors.aliyun.com/debian-security bookworm-security InRelease Ign:3 https://download.docker.com/linux/debian bookworm InRelease Hit:4 https://mirrors.aliyun.com/debian bookworm-updates InRelease Hit:5 https://mirrors.aliyun.com/debian bookworm-backports InRelease Ign:3 https://download.docker.com/linux/debian bookworm InRelease Ign:3 https://download.docker.com/linux/debian bookworm InRelease Hit:3 https://download.docker.com/linux/debian bookworm InRelease Err:3 https://download.docker.com/linux/debian bookworm InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date. W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://download.docker.com/linux/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 W: Failed to fetch https://download.docker.com/linux/debian/dists/bookworm/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 W: Some index files failed to download. They have been ignored, or old ones used instead. W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_debian-bookworm.list:1 and /etc/apt/sources.list.d/docker.list:1 W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_debian-bookworm.list:1 and /etc/apt/sources.list.d/docker.list:1 W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/
03-12
<think>好的,我现在需要帮助用户解决APT更新时无法解析存储库地址的问题,具体是关于storage.googleapies.com bazel-aptUbuntu上的问题。首先,我得理解用户的问题。用户在执行apt-get update时遇到了无法解析存储库地址的错误,可能存储库配置中的URL有误或者网络问题。 首先,我应该检查用户提到的存储库地址是否正确。用户提到的是storage.googleapies.com,但正确的Bazel APT仓库地址应该是storage.googleapis.com,这里可能用户拼写错误,把“googleapis”写成了“googleapies”。这是一个常见的拼写错误,所以需要确认这一点。 接下来,用户可能在系统中添加了Bazel的APT源,但配置文件中可能写错了URL。需要让用户检查/etc/apt/sources.list.d/目录下的相关文件,比如bazel.list或者google-cloud-sdk.list,确认其中的URL是否正确。正确的格式应该是deb https://storage.googleapis.com/bazel-apt stable main之类的。 如果URL确实有误,用户需要修改该文件,将错误的地址更正为正确的storage.googleapis.com。然后运行sudo apt-get update看看是否解决问题。 如果URL正确但依然无法解析,可能的问题包括DNS配置错误、网络连接问题,或者存储库服务器暂时不可用。这时候可以建议用户尝试ping storage.googleapis.com来测试连通性,或者更换DNS服务器,比如使用8.8.8.8(Google的公共DNS)。 另外,用户可能需要检查Bazel的APT存储库是否还在维护,或者是否有新的配置方式。比如,Bazel的官方文档可能更新了存储库地址,需要用户按照最新的指南重新添加源。 还有,引用中的内容可能涉及其他问题,比如NVIDIA驱动卸载、autoconf缺失、Docker运行CUDA镜像等,但当前问题与这些无关,暂时不需要考虑。不过需要注意是否正确引用了相关的解决方案,但在此问题中可能不适用。 最后,生成相关问题时要围绕APT存储库配置、DNS问题、Bazel安装等方向,帮助用户扩展可能遇到的类似问题。</think>要解决APT更新时无法解析`storage.googleapies.com`的问题,请按以下步骤排查: ### 1. 检查存储库地址拼写 **错误原因**:存储库地址`storage.googleapies.com`中的`googleapies`应为`googleapis`(缺少字母`s`)[^1]。 **解决方法**: - 打开APT源文件(如`/etc/apt/sources.list.d/bazel.list`或`/etc/apt/sources.list.d/google-cloud-sdk.list`) - 将地址更正为: ```bash deb https://storage.googleapis.com/bazel-apt stable main ``` ### 2. 验证网络连通性 **若地址已修正仍无法解析**: ```bash ping storage.googleapis.com # 测试域名解析是否正常 curl -v https://storage.googleapis.com # 检查HTTPS连接 ``` - 若提示`Name or service not known`,可能是DNS配置问题,可尝试更换DNS服务器: ```bash echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf # 使用Google DNS ``` ### 3. 清理APT缓存 ```bash sudo rm -rf /var/lib/apt/lists/* # 删除旧缓存 sudo apt-get clean sudo apt-get update # 重新尝试更新 ``` ### 4. 检查Bazel存储库状态 确认Bazel存储库是否已迁移或停止服务。可参考[官方文档](https://bazel.build/install/ubuntu)更新存储库配置。 ---
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值