While running docker build its showing non zero code : 8 error

Down below is the content of my dockerfile while running docker build its showing nonzero code : 8

FROM centos:7
MAINTAINER rishav.jaiswal.2019@gmail.com

ENV KAFKA_BIN=http://www-eu.apache.org/dist/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz

RUN yum install -y wget java-1.8.0-openjdk
&& cd /tmp && wget -q KAFKA_BIN \ && export K_TAR=/tmp/(ls kafka* | head -1)
&& mkdir -p /opt/apache/kafka/ && tar -zxf K_TAR -C /opt/apache/kafka/ \ && cd /opt/apache/kafka && ln -s (ls) current
&& rm -rf $K_TAR

ENV KAFKA_HOME /opt/apache/kafka/current
ENV PATH $PATH:$KAFKA_HOME/bin

ADD resources /home/kafka

RUN groupadd -r kafka
&& useradd -r -g kafka kafka
&& mkdir -p /home/kafka
&& chown -R kafka:kafka /home/kafka
&& chmod -R +x /home/kafka/scripts
&& mkdir -p /var/log/kafka
&& chown -R kafka:kafka /var/log/kafka
&& mkdir -p /etc/kafka
&& chown -R kafka:kafka /etc/kafka

USER kafka

CMD /home/lucky/Desktop/script/run.sh

You have many syntax errors in this file, this should be a better start :

FROM centos:7
MAINTAINER rishav.jaiswal.2019@gmail.com

ENV KAFKA_BIN http://www-eu.apache.org/dist/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz

RUN yum install -y wget java-1.8.0-openjdk \
 && cd /tmp && wget -q $KAFKA_BIN \ 
 && export K_TAR=/tmp/(ls kafka* | head -1) \
 && mkdir -p /opt/apache/kafka \
 && tar -zxf $K_TAR -C /opt/apache/kafka/ \
 && cd /opt/apache/kafka && ln -s $(ls) current \
 && rm -rf $K_TAR

ENV KAFKA_HOME /opt/apache/kafka/current
ENV PATH $PATH:$KAFKA_HOME/bin

ADD resources /home/kafka

RUN groupadd -r kafka \
 && useradd -r -g kafka kafka \
 && mkdir -p /home/kafka \
 && chown -R kafka:kafka /home/kafka \
 && chmod -R +x /home/kafka/scripts \
 && mkdir -p /var/log/kafka \
 && chown -R kafka:kafka /var/log/kafka \
 && mkdir -p /etc/kafka \
 && chown -R kafka:kafka /etc/kafka

USER kafka

CMD /home/lucky/Desktop/script/run.sh

(I’m guessing you’re having a paste issue more than anything here)

But that wont be enough :

  • You should probably add that /home/lucky/Desktop/script/run.sh file inside the image (and probably at a better place).
  • K_TAR is always /tmp/kafka_2.11-0.11.0.0.tgz. You should probably try something like :
ENV KAFKA_VER 0.11.0.0
ENV KAFKA_FULLVER 2.11-$KAFKA_VER
ENV KAFKA_BIN http://www-eu.apache.org/dist/kafka/$KAFKA_VER/kafka_$KAFKA_FULLVER.tgz
ENV K_TAR /tmp/kafka_$KAFKA_FULLVER.tgz
  • Remplace that ugly ln -s $(ls) current with a better link using the versions ENV set ealier.
  • Your actual issue is the wget which return 8 in case of 404 error : the file $KAFKA_BIN is not available on the apache website. you should probably check for a valid version :stuck_out_tongue: (like : http://www-eu.apache.org/dist/kafka/2.2.1/kafka_2.11-2.2.1.tgz aka set KAFKA_VER to 2.2.1)

can you please help with the steps to remove that wget issue

As sebt3 already said:

So to solve your problem, you must change

to

ENV KAFKA_VER 2.2.1

So your wget will do

wget http://www-eu.apache.org/dist/kafka/2.2.1/kafka_2.11-2.2.1.tgz