gpt4 book ai didi

docker - : Error while installing apache web server on ubuntu 获取失败

转载 作者:行者123 更新时间:2023-12-04 19:27:44 28 4
gpt4 key购买 nike

我正在尝试构建一个 docker 镜像。从 Dockerfile 运行 apache Web 服务器的安装命令时,弹出错误。
enter image description here
注意:我已经在实际文件中添加了 -y 和 apache2-utils 之间的空格。

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2021a-0ubuntu0.20.04_all.deb  404  Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-bin_2.4.41-4ubuntu3.4_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-data_2.4.41-4ubuntu3.4_all.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.4.41-4ubuntu3.4_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.4.41-4ubuntu3.4_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20210119~20.04.1_all.deb 404 Not Found [IP: 91.189.88.152 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get install -y apache2' returned a non-zero code: 100
我尝试运行更新命令并再次构建 Dockerfile,但错误仍然存​​在。

最佳答案

我刚刚使用 Dockerfile 运行了您的示例

FROM ubuntu
MAINTAINER "me"
RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y apache2-utils
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
然后运行 ​​ docker build .我没有察觉到您遇到的网络问题,但安装变成了交互式:
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
2. America 5. Arctic 8. Europe 11. SystemV
3. Antarctica 6. Asia 9. Indian 12. US
Geographic area:
所以你可能想要
  • 重新运行您的代码
  • 确保 apt-get 不会进行交互

  • 最后一句话: apt-get clean根本不会使您的图像变小。每 RUN添加一个文件系统层,这意味着您将添加一个告诉它隐藏文件的层。为防止这种情况,请将您的调用链接到 apt-get合二为一 RUN像这样的行:
    RUN apt-get update && apt-get install -y apache2 && apt-get install -y apache2-utils && apt-get clean

    关于docker - : Error while installing apache web server on ubuntu 获取失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69535804/

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