0

libwww-perl当我在 docker 中创建我的 ubuntu 映像时,我需要这个包。所以在我的 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
4

1 回答 1

1

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

RUN apt-get update

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

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

于 2016-03-18T11:32:21.297 回答