spotify / docker-kafka

Kafka (and Zookeeper) in Docker
Apache License 2.0
1.4k stars 640 forks source link

Docker build no longer works #96

Open bigOconstant opened 5 years ago

bigOconstant commented 5 years ago

I tried

git clone https://github.com/spotify/docker-kafka
cd docker-kafka/
cd kafka
docker build -t kafka:0.10.1.0 .

and I get the following error

Get:6 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Err http://deb.debian.org jessie-backports/main amd64 Packages

Err http://deb.debian.org jessie-backports/main amd64 Packages

Err http://deb.debian.org jessie-backports/main amd64 Packages

Err http://deb.debian.org jessie-backports/main amd64 Packages

Err http://deb.debian.org jessie-backports/main amd64 Packages
  404  Not Found
Fetched 10.1 MB in 17s (583 kB/s)
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease  Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update &&     apt-get install -y zookeeper wget supervisor dnsutils &&     rm -rf /var/lib/apt/lists/* &&     apt-get clean &&     wget -q http://apache.mirrors.spacedump.net/kafka/"$KAFKA_VERSION"/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION".tgz -O /tmp/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION".tgz &&     tar xfz /tmp/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION".tgz -C /opt &&     rm /tmp/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION".tgz' returned a non-zero code: 100
bigOconstant commented 5 years ago

I was able to get the build working by changing the docker file to the following (Maybe this will help with an official fix)

# Kafka and Zookeeper

FROM java:openjdk-8-jre

ENV DEBIAN_FRONTEND noninteractive
ENV SCALA_VERSION 2.11
ENV KAFKA_VERSION 2.1.1
ENV KAFKA_HOME /opt/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION"

RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
# As suggested by a user, for some people this line works instead of the first one. Use whichever works for your case
# RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
# Install Kafka, Zookeeper and other needed things
RUN apt-get -o Acquire::Check-Valid-Until=false update && \
    apt-get -o Acquire::Check-Valid-Until=false install -y zookeeper wget supervisor dnsutils && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean && \
    wget -q http://apache.mirrors.spacedump.net/kafka/2.1.1/kafka_"$SCALA_VERSION"-2.1.1.tgz -O /tmp/kafka_"$SCALA_VERSION"-2.1.1.tgz && \
    tar xfz /tmp/kafka_2.11-2.1.1.tgz -C /opt && \
    rm /tmp/kafka_2.11-2.1.1.tgz

ADD scripts/start-kafka.sh /usr/bin/start-kafka.sh

# Supervisor config
ADD supervisor/kafka.conf supervisor/zookeeper.conf /etc/supervisor/conf.d/

# 2181 is zookeeper, 9092 is kafka
EXPOSE 2181 9092

CMD ["supervisord", "-n"]
dude0001 commented 5 years ago

@camccar thank you for posting your work around, this worked for me. very timely too, just started playing around with this today and hit the same error.

bigOconstant commented 5 years ago

While it did build my kafka instance seems to crash afterwords. I'm trying to add sasl plain text auth to test a script.

@dude0001 Is your kafka instance working for you?

dude0001 commented 5 years ago

I had to add a line to make start-kafka.sh executable. Other than that, it seems to startup for me. I haven't done more with it yet.

After the existing line ADD scripts/start-kafka.sh /usr/bin/start-kafka.sh

I added RUN chmod a+x /usr/bin/start-kafka.sh

pipeti commented 4 years ago

If someone ends up here, this is also a viable solution for stepping versions. Change the beginning of the Dockerfile under kafka dir:

FROM openjdk:11-jre

ENV DEBIAN_FRONTEND noninteractive
ENV SCALA_VERSION 2.13
ENV KAFKA_VERSION 2.4.0
ENV KAFKA_HOME /opt/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION"