The command '/bin/sh -c returned a non-zero code: 127
Solution 1
Solution to the image with error is to add before the wget CMD
RUN yum -y install wget
If you write it like this, it is the same result, just different execution:
RUN wget http://www.us.apache.org/dist/tomcat/tomcat-6/v6.0.44/bin/apache-tomcat-6.0.44.tar.gz
Don't use the quotes and comma in RUN
command.
Solution 2
Exit code 127 from shell commands means "command not found". So, in your case it seems the "wget" within quotes is not being found when Docker runs it.
In some cases, the command to install wget (or whatever command-line tool is missing) must first be run in the Dockerfile because some base Docker images will not have wget. You would add a line before the failing command that looks something like this:
RUN yum install -y wget
Solution 3
Do not forget you can add all lib and package you need on the same line
RUN cd /tmp \
&& apt-get update \
&& apt-get install -y curl apt-utils wget unzip\
&& rm -rf /var/lib/apt/lists/*
user5201726
Updated on February 25, 2020Comments
-
user5201726 about 4 years
I'm new to docker so I might be doing this wrong, but I'm trying to install Tomcat6 through a
Dockerfile
which like this:FROM rhel7:latest RUN cd /tmp RUN "wget", "http://www.us.apache.org/dist/tomcat/tomcat-6/v6.0.44/bin/apache-tomcat-6.0.44.tar.gz" RUN tar xzf apache-tomcat-6.0.44.tar.gz RUN mv apache-tomcat-6.0.44 /usr/local/tomcat6 RUN cd /usr/local/tomcat6 Run ./bin/start.sh
Its failing on the 3rd line with the:
RUN "wget", "http://www.us.apache.org/dist/tomcat/tomcat-6/v6.0.44/bin/apache-tomcat-6.0.44.tar.gz"
When I run the docker build I get this:
I'm using:
- Oracle Virtual Box V4.3.28 r100309
- Docker on RHEL7
Thanks in advance for any help.
-
user5201726 over 8 yearsIt makes no difference to it, it still gives the same error
-
Dharmit over 8 yearsIn that case, add the statement
RUN yum -y install wget
before the line that throws error. -
user5201726 over 8 yearsThanks, I'm after trying that, but it exits with code 1 now. This is what is displayed. i.imgur.com/wqmlenh.png I have a subscription with RedHat and I'm using it on the machine, do I have to do a subscription-manager login with Docker?
-
Dharmit over 8 yearsI've not used RHEL image since a while. But the message indicates that you need to register with Red Hat Subscription Manager. I'd suggest you to take Red Hat Support's help in this if you can.