请在下面找到docker文件的内容-

FROM centostaryum
MAINTAINER karthik.jayaraman
VOLUME ["/DockerFiles/Tomcat/tar"]
ADD /tar/apache-tomcat-7.0.47.tar.gz /tmp
RUN ls /tmp
RUN tar -tzf /tmp/apache-tomcat-7.0.47.tar.gz -C /opt
EXPOSE  8080
CMD service tomcat7 start

它给我以下错误
    Step 0 : FROM centostaryum
     ---> 175c30b6dbd7
    Step 1 : MAINTAINER karthik.jayaraman
     ---> Running in 8872c0c61735
     ---> d16323a6931a
    Removing intermediate container 8872c0c61735
    Step 2 : VOLUME ["/DockerFiles/Tomcat/tar"]
     ---> Running in 829a35f36b3f
     ---> 74314abbc28e
    Removing intermediate container 829a35f36b3f
    Step 3 : ADD /tar/apache-tomcat-7.0.47.tar.gz /tmp
     ---> 07a0bc6713ab
    Removing intermediate container 3af17fba511a
    Step 4 : RUN ls /tmp
     ---> Running in 113ed759c156
    apache-tomcat-7.0.47
     ---> 6fd41ed2fb76
    Removing intermediate container 113ed759c156
    Step 5 : RUN tar -tzf /tmp/apache-tomcat-7.0.47.tar.gz -C /opt
     ---> Running in 08e4d0a1f30a
    tar (child): /tmp/apache-tomcat-7.0.47.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    2014/06/13 18:25:32 The command [/bin/sh -c tar -tzf /tmp/apache-tomcat-7.0.47.tar.gz -C /opt] returned a non-
    zero code: 2

容器中temp目录中的list命令列出了tomcat文件,但是我不确定tar命令出了什么问题。

在解决这个问题方面,我将不胜感激。谢谢。

最佳答案

根据documentation on the ADD command:



您可以直接将文件ADD转换为/opt,它将执行您想要的操作。更明确地说,只需执行以下操作:
ADD /tar/apache-tomcat-7.0.47.tar.gz /opt

关于centos - Dockerfile-挂载主机目录-复制tar文件并运行-错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24214659/

10-16 23:40
查看更多