'/bin/sh -c apt-get -y update' returned a non-zero code: 127

I am using docker mac and trying to install supervisor , before that, docker is complaining that apt-get not found.plz help
RUN apt-get -y update && apt-get install -y supervisor

I am using docker on a mac.

you tried to call a command

“/bin/sh -c apt-get…”

it then complains that it cannot find an executable called “/bin/sh -c …”. Sure.

The command should look like

/bin/sh -c “apt-get -y update …”

or shorter like

apt-get -y update

1 Like

####installing supervisor
RUN apt-get -y update && apt-get install -y supervisor

was my exact command inside my dockerfile.

am following https://docs.docker.com/engine/admin/using_supervisord/ url… except that am not using ubuntu…

should work…can you paste your whole Dockerfile - or even better automate your docker image build with docker hub? then easily could help you.

PS: using supervisord and similar tools within a docker container is considered a bad practice. try to split your containers so that each of them is just running one command, one process.

the below is my complete docker file (plz note the ### were showing as comments in bold)

FROM java:8-alpine

MAINTAINER *********@.com

####installing supervisor
RUN apt-get -y update && apt-get install -y supervisor

####downloading & unpacking Spark 1.6.1 [prebuilt for Hadoop 2.7+ and scala 2.10]
RUN wget http://apache.mirrors.lucidnetworks.net/spark/spark-2.1.0/spark-2.1.0-bin-hadoop2.7.tgz
&& tar -xzf spark-2.1.0-bin-hadoop2.7.tgz
&& mv spark-2.1.0-bin-hadoop2.7 /opt/spark

#####adding conf files [to be used by supervisord for running spark master/slave]
COPY master.conf /opt/conf/master.conf
COPY slave.conf /opt/conf/slave.conf

#######exposing port 8080 for spark master UI
EXPOSE 8080

#default command: running an interactive spark shell in the local mode
CMD ["/opt/spark/bin/spark-shell", “–master”, “local[*]”]

apt-get works on ubuntu, you are using java8-alpine…a mini-linux-distro. There you need to use apk for example.

1 Like

Thank you, I love this comment.
I saved time.