【问题标题】:Failed to fetch : Error while installing apache web server on ubuntu获取失败:在 ubuntu 上安装 apache Web 服务器时出错
【发布时间】:2021-11-30 18:30:08
【问题描述】:

我正在尝试构建一个 docker 映像。从 Dockerfile 运行 apache Web 服务器的安装命令时,弹出错误。

注意:我已经在实际文件中添加了 -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,但错误仍然存​​在。

【问题讨论】:

  • 请don't upload text as image。编辑您的问题以包含文本形式的所有信息 - 考虑使用编辑器的格式选项。另见How to Ask。并确保您不需要代理来访问互联网(或配置它)。

标签: docker apache ubuntu


【解决方案1】:

我刚刚使用 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-14
    • 2020-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-11
    相关资源
    最近更新 更多