Dockerfile - 装载主机目录 - 复制tar文件并运行它 - 错误

时间:2014-06-13 22:35:53

标签: centos tar docker

请在下面找到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命令有什么问题。

我很感激帮助找出这个问题。谢谢。

1 个答案:

答案 0 :(得分:1)

RUN yum -y update&& \ yum -y install wget&& \ yum install -y tar.x86_64&& \     yum clean all