[英]Docker build fails with “RUN: command not found”
I am running below contents in dockerfile it runs until yum installation and fails as, /bin/sh: RUN: command not found 我正在dockerfile中的内容下面运行,直到yum安装为止,它一直运行到/ bin / sh失败:RUN:找不到命令
DockerFile: DockerFile:
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar
RUN cd /tmp/TeradataToolsAndUtilitiesBase/ && ./setup.bat a
CMD ["/bin/bash"]
Error: 错误:
Installed:
libstdc++.i686 0:7.3.1-5.amzn2.0.2
Dependency Installed:
glibc.i686 0:2.26-32.amzn2.0.1 libgcc.i686 0:7.3.1-5.amzn2.0.2
Complete!
/bin/sh: RUN: command not found
The command '/bin/sh -c yum install gzip -y && yum install tar -y && yum install libstdc++.so.6 -y && RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar' returned a non-zero code: 127
system:ttudockerimg$
Please help. 请帮忙。
Just use one RUN command, and escape newlines. 只需使用一个RUN命令,然后换行即可。 If you have several commands, you have to wrap them in a bash command.
如果有多个命令,则必须将它们包装在bash命令中。
Besides that, you can extract from a .tar.gz
file directly without uncompressing it first. 除此之外,您可以直接从
.tar.gz
文件中提取文件,而无需先对其进行解压缩。
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
/bin/bash -c 'cd /tmp && \
/usr/bin/tar -xzvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && \
cd /tmp/TeradataToolsAndUtilitiesBase/ && \
./setup.bat a
CMD ["/bin/bash"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.