2016-10-04 24 views
1

我有一个奇怪的问题试图顺序执行几个RUN命令。运行命令之间Dockerfile意外的行为

目标是复制一个文件夹。 如果我列出的目标文件夹中的文件:

  • 它在相同的运行工作与& & LS
  • 它不能在另一个运行

在这里工作是跟踪:

Step 6 : RUN cp -rf /app/httpd/htdocs/* /opt/rh/httpd24/root/var/www/html/ && ls /opt/rh/httpd24/root/var/www/html/ 
---> Running in 05842445d075 
modules 
tests 
---> 05c51d512f60 
Removing intermediate container 05842445d075 
Step 7 : RUN ls /opt/rh/httpd24/root/var/www/html/ 
---> Running in aa217a8edc37 
---> 095c9f8ac8e7 

你知道怎么回事吗?

+0

在构建结束后发布Dockerfile – user2915097

+0

,你有你的文件吗? – user2915097

+1

我的Dockerfile中没有什么有趣的。 我想这个问题很可能是在父Dockerfile中 FROM rhscl/httpd-24-rhel7:2.4-10 – egt

回答

1

seen here,如果Dockerfile首先声明为VOLUME,则可能发生这种情况。

任何复制到VOLUME中的文件都将被丢弃,因为每个构建步骤都会根据图像的内容创建一个新卷,并放弃在之前构建步骤中使用的卷。