为什么不缓存docker层?

时间:2019-03-06 07:25:08

标签: docker caching

我有具有下一个命令的Dockerfile:

RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION

这里的图层开始重建:

Step 12/27 : RUN echo -e "\nif [ -f /opt/perlbrew/etc/bashrc ]; then\n\tsource /opt/perlbrew/etc/bashrc\nfi\n" >> /root/.bash_profile
 ---> Using cache
 ---> b18437df38fb
Step 13/27 : RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION
 ---> Running in 3b76e5d4ae0a

Fetching perl 5.24.1 as /opt/perlbrew/dists/perl-5.24.1.tar.bz2
Download http://www.cpan.org/authors/id/S/SH/SHAY/perl-5.24.1.tar.bz2 to /opt/perlbrew/dists/perl-5.24.1.tar.bz2
Installing /opt/perlbrew/build/perl-5.24.1/perl-5.24.1 into /opt/perlbrew/perls/perl-5.24.1

为什么此命令不使用缓存层?

UPD
码头工人文件:

FROM centos:latest

ARG PERLBREW_ROOT=/opt/perlbrew
ARG PERL_VERSION=5.24.1
ARG MONKEYMAN_DIR=/opt/monkeyman

RUN yum -y install yum-plugin-ovl
RUN yum -y upgrade
RUN yum -y install perl
RUN yum-builddep -y perl
RUN yum install -y bzip2 zip which
RUN yum groupinstall -y 'Development Tools'
RUN curl -L https://install.perlbrew.pl | bash
RUN echo -e "\nif [ -f /opt/perlbrew/etc/bashrc ]; then\n\tsource /opt/perlbrew/etc/bashrc
\nfi\n" >> /root/.bash_profile
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew switch $PERL_VERSION
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install-cpanm
RUN source $PERLBREW_ROOT/etc/bashrc && cpanm Carton

构建时不提供参数

UPD

$ docker --version
Docker version 1.13.1, build 07f3374/1.13.1

0 个答案:

没有答案