【问题标题】:Building a Docker Image results in error while trying to install libwww-perl i.e., perl-modules_5.14.2-6 and perl_5.14.2-6 Not found尝试安装 libwww-perl 时构建 Docker 映像会导致错误,即 perl-modules_5.14.2-6 和 perl_5.14.2-6 Not found
【发布时间】:2016-06-30 17:59:13
【问题描述】:

当我在 docker 中创建我的 ubuntu 映像时,我需要包 libwww-perl。 所以在我的 Docker 文件中,我添加了这一行

RUN apt-get install -y libwww-perl

但是当我尝试构建这个 Docker 映像时

sudo docker build -t web-service:latest .

我最终得到以下错误。

错误:

Step 3 : RUN apt-get install -y libwww-perl
 ---> Running in 5c6c1fdd3b66
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libclass-isa-perl libencode-locale-perl libfile-listing-perl
  libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libio-socket-inet6-perl libio-socket-ssl-perl
  liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl
  libnet-http-perl libnet-ssleay-perl libsocket6-perl libswitch-perl
  libtimedate-perl liburi-perl libwww-robotrules-perl perl perl-modules
Suggested packages:
  libdata-dump-perl libcrypt-ssleay-perl libmime-base64-perl
  libauthen-ntlm-perl perl-doc libterm-readline-gnu-perl
  libterm-readline-perl-perl libpod-plainer-perl
The following NEW packages will be installed:
  libclass-isa-perl libencode-locale-perl libfile-listing-perl
  libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libio-socket-inet6-perl libio-socket-ssl-perl
  liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl
  libnet-http-perl libnet-ssleay-perl libsocket6-perl libswitch-perl
  libtimedate-perl liburi-perl libwww-perl libwww-robotrules-perl perl
  perl-modules
0 upgraded, 29 newly installed, 0 to remove and 12 not upgraded.
Need to get 9092 kB of archives.
After this operation, 36.5 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main libclass-isa-perl all 0.36-3 [11.9 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libswitch-perl all 2.16-2 [19.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libencode-locale-perl all 1.02-2 [12.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main libtimedate-perl all 1.2000-1 [41.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main libhttp-date-perl all 6.00-1 [10.1 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main libfile-listing-perl all 6.03-1 [9690 B]
Get:7 http://archive.ubuntu.com/ubuntu/ precise/main libfont-afm-perl all 1.20-1 [14.3 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ precise/main liburi-perl all 1.59-1 [90.3 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-tagset-perl all 3.20-2 [13.5 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-parser-perl amd64 3.69-1build1 [97.3 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ precise/main liblwp-mediatypes-perl all 6.01-1 [17.5 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ precise/main libhttp-message-perl all 6.01-1 [77.6 kB]
Get:13 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-form-perl all 6.00-1 [22.8 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-tree-perl all 4.2-1 [205 kB]
Get:15 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-format-perl all 2.10-1 [40.6 kB]
Get:16 http://archive.ubuntu.com/ubuntu/ precise/main libhttp-cookies-perl all 6.00-2 [23.3 kB]
Get:17 http://archive.ubuntu.com/ubuntu/ precise/main libhttp-daemon-perl all 6.00-1 [16.7 kB]
Get:18 http://archive.ubuntu.com/ubuntu/ precise/main libhttp-negotiate-perl all 6.00-2 [13.4 kB]
Get:19 http://archive.ubuntu.com/ubuntu/ precise/main libsocket6-perl amd64 0.23-1build2 [21.9 kB]
Get:20 http://archive.ubuntu.com/ubuntu/ precise/main libio-socket-inet6-perl all 2.69-2 [14.3 kB]
Get:21 http://archive.ubuntu.com/ubuntu/ precise/main libnet-ssleay-perl amd64 1.42-1build1 [188 kB]
Get:22 http://archive.ubuntu.com/ubuntu/ precise/main libio-socket-ssl-perl all 1.53-1 [47.5 kB]
Get:23 http://archive.ubuntu.com/ubuntu/ precise/main libnet-http-perl all 6.02-1 [23.5 kB]
Get:24 http://archive.ubuntu.com/ubuntu/ precise/main libwww-robotrules-perl all 6.01-1 [14.1 kB]
Get:25 http://archive.ubuntu.com/ubuntu/ precise/main libwww-perl all 6.03-1 [156 kB]
Get:26 http://archive.ubuntu.com/ubuntu/ precise/main liblwp-protocol-https-perl all 6.02-1 [6746 B]
Get:27 http://archive.ubuntu.com/ubuntu/ precise/main libmailtools-perl all 2.08-1 [84.0 kB]
Err http://archive.ubuntu.com/ubuntu/ precise-security/main perl-modules all 5.14.2-6ubuntu2.4
  404  Not Found [IP: 91.189.88.153 80]
Err http://archive.ubuntu.com/ubuntu/ precise-security/main perl amd64 5.14.2-6ubuntu2.4
  404  Not Found [IP: 91.189.88.153 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/perl/perl-modules_5.14.2-6ubuntu2.4_all.deb  404  Not Found [IP: 91.189.88.153 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/perl/perl_5.14.2-6ubuntu2.4_amd64.deb  404  Not Found [IP: 91.189.88.153 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Fetched 1293 kB in 8s (145 kB/s)
The command '/bin/sh -c apt-get install -y libwww-perl' returned a non-zero code: 100

但是,当我尝试在运行 ubuntu 的本地计算机上手动运行该命令时,它工作正常。 apt-get install -y libwww-perl

知道有什么问题吗?

更新: 我的 Docker 文件内容 -

FROM dockerhub.corp.comp.com/idp/docker-jvm-8
MAINTAINER bandikishores@yahoo.com

RUN apt-get update
RUN apt-get install -y libwww-perl

ENV basedir /opt/comp/apps/web-service
ENV libdir ${basedir}/lib
ENV confdir ${basedir}/conf
ENV bindir ${basedir}/bin
ENV logdir /opt/comp/logs/web-service

RUN mkdir -p ${libdir} ${confdir} ${logdir}
RUN chown -R nobody:nogroup ${libdir}
RUN chown -R nobody:nogroup ${confdir}
RUN chown -R nobody:nogroup ${logdir}


ADD setup.sh ${bindir}/setup.sh
ADD service_start.sh /tmp/service_start.sh
ADD healthcheck.pl /tmp/healthcheck.pl

RUN cd /tmp && mkdir test_config && mv config.jar test_config/config.jar && cd test_config && jar -xvf config.jar && rm config.jar
RUN cd /tmp && mkdir test_env && mv env.jar test_env/env.jar && cd test_env && jar -xvf env.jar && rm env.jar

RUN chown -R nobody:nogroup ${bindir}
RUN chmod -R +x ${bindir}/setup.sh

EXPOSE 11040

【问题讨论】:

  • 你能发布你的 Dockerfile 吗?你是从apt-get update 开始的吗?你使用哪个发行版(Ubuntu、Debian、Centos、Alpine...)?
  • 也许先试试RUN apt-get update。我自己对 docker 很陌生,但我相信如果您查看 docker ps 的输出,您可以连接到 docker 映像 sudo docker exec -it <containerIdOrName> bash,然后手动尝试安装过程,直到您开始工作为止。跨度>
  • 我已经更新了我使用的 Docker 文件。是的,我也更新了。此外,我对多个其他图像使用了相同的 dockerFile,它们过去工作正常。我开始只使用我正在创建的这个新图像来面对这个问题。
  • 我认为这与 apt setup 有关。能否在图片中显示/etc/apt/sources.list和/etc/apt/sources.list.d的内容?

标签: perl ubuntu docker docker-build


【解决方案1】:

看起来问题是下载的 linux 映像。 使用另一个版本的图像并添加后

RUN apt-get update

所有其他 RUN 命令之前的行,即使对于我现有的 DockerFile(到现在为止)也解决了这个问题。

但我仍然不确定这些现有的 DockerFile 是如何工作的。

【讨论】:

    猜你喜欢
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-23
    相关资源
    最近更新 更多