gpt4 book ai didi

ubuntu - Docker build apt-get update 无法获取 403

转载 作者:行者123 更新时间:2023-12-04 18:45:32 25 4
gpt4 key购买 nike

我已经看到了一些关于此的问题,但没有一个与我的问题相同。我的数据中心有一台运行 Ubuntu 16.04 的服务器,所以它在技术上是一个虚拟机。我已经安装了 Docker,现在我正在尝试构建以下 Dockerfile:

FROM ubuntu:16.04

RUN apt-get update

更新失败。我得到了一堆这样的:
Ign:35 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:37 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:41 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages

接着:
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/source/Sources  403  Forbidden [IP: 91.189.91.26 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/source/Sources 403 Forbidden [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/source/Sources 403 Forbidden [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/main/binary-amd64/Packages 403 Forbidden [IP: 91.189.88.152 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

运行 sudo apt-get update在我的服务器上(不在 Docker 镜像中)工作得很好。

最佳答案

我打了类似的东西:apt-get update'docker build' 期间会失败虽然 /etc/apt/apt.conf
在主机中设置,'sudo apt-get update'在主机工作。

我将其修复如下:

Step 1: Copy /etc/apt/apt.conf to the local directory where Dockerfile resides (build context directory for docker).

Step 2: Add the following lines to Dockerfile:


RUN mkdir -p /etc/apt  
COPY apt.conf /etc/apt`
RUN apt-get update && \
apt-get -y install`

关于ubuntu - Docker build apt-get update 无法获取 403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44725835/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com