The command '/bin/sh -c returned a non-zero code: 127 The command '/bin/sh -c returned a non-zero code: 127 docker docker

The command '/bin/sh -c returned a non-zero code: 127


Solution to the image with error is to add before the wget CMDRUN 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.


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


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/*