Reputation: 97
I am running below contents in dockerfile it runs until yum installation and fails as, /bin/sh: RUN: command not found
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.
Upvotes: 1
Views: 19661
Reputation: 331
Just use one RUN command, and escape newlines. If you have several commands, you have to wrap them in a bash command.
Besides that, you can extract from a .tar.gz
file directly without uncompressing it first.
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"]
Upvotes: 2