1

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.

2
  • 3
    RUN cd /tmp is taken as part of the previous RUN command, because the line before it ends with a backslash. Commented Feb 6, 2019 at 23:58
  • 1
    Remove the trailing backslash on the 3rd line of the first RUN command. Commented Feb 7, 2019 at 2:24

1 Answer 1

2

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"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.