无法从Dockerfile运行shell脚本哪个容器有些stdin来完成脚本

时间:2017-07-04 08:26:29

标签: dockerfile

你好,当我们运行相同的脚本时,我有一个名为postrun.sh的脚本,因此它需要用户输入来运行脚本,用户需要提供yes,输入,是

我有泊坞文件

FROM centos:latest
RUN useradd jenkins -u 1001
RUN echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN mkdir /opt/SOAtest
RUN mkdir /opt/SOAtest/parasoft
ADD epel.repo /etc/yum.repos.d/epel.repo
ADD RPM-GPG-KEY-EPEL-7  /etc/pki/rpm-gpg/
RUN yum -y clean all
#RUN yum -y install wget
ADD parasoft_soatest_9.7_linux_20140227.sh  /opt/SOAtest/
RUN chmod +x /opt/SOAtest/parasoft_soatest_9.7_linux_20140227.sh
RUN cd  /opt/SOAtest/parasoft
RUN echo "1/yes" | postrun.sh

建立码头图像时我得到的错误

**Step 12/12 : RUN echo "1/yes" |     ./parasoft_soatest_9.7_linux_20140227.sh
 ---> Running in 973ce094358a


/bin/sh: ./parasoft_soatest_9.7_linux_20140227.sh: No such file or directory

The command '/bin/sh -c echo "1/yes" | ./parasoft_soatest_9.7_linux_20140227.sh' returned a non-zero code: 127**

1 个答案:

答案 0 :(得分:0)

阿图尔,

bash给你回答:“没有这样的文件或目录”和错误代码127。 你确定你在正确的目录中吗?

首先你有这个:

b

然后你

ADD parasoft_soatest_9.7_linux_20140227.sh  /opt/SOAtest/

并执行postrun.sh

我将重复我的问题:您确定在/ opt / SOAtest / parasoft目录中有Parasoft SOAtest安装文件吗?