wurstmeister / kafka-docker

Dockerfile for Apache Kafka
http://wurstmeister.github.io/kafka-docker/
Apache License 2.0
6.92k stars 2.73k forks source link

Docker Compose Failing to Build Kakfa Image #319

Open garystafford opened 6 years ago

garystafford commented 6 years ago

Running the commands, docker-compose up -d or the docker-compose -f docker-compose-single-broker.yml up, consistently fails on Docker build of the Kafka image.

System: Windows 10 Enterprise Docker Version 18.04.0-ce-win62 (17151)

$ docker-compose up -d
Building kafka
Step 1/11 : FROM openjdk:8u151-jre-alpine
 ---> b1bd879ca9b3
Step 2/11 : ARG kafka_version=1.1.0
 ---> Using cache
 ---> 2ceda394f7ce
Step 3/11 : ARG scala_version=2.12
 ---> Using cache
 ---> c6bcf9f30eae
Step 4/11 : ARG glibc_version=2.27-r0
 ---> Using cache
 ---> c41046a88202
Step 5/11 : MAINTAINER wurstmeister
 ---> Using cache
 ---> 9d3c464fd5ed
Step 6/11 : ENV KAFKA_VERSION=$kafka_version     SCALA_VERSION=$scala_version     KAFKA_HOME=/opt/kafka     GLIBC_VERSION=$glibc_version
 ---> Using cache
 ---> 06c606a469a2
Step 7/11 : ENV PATH=${PATH}:${KAFKA_HOME}/bin
 ---> Using cache
 ---> c70117277e66
Step 8/11 : COPY download-kafka.sh start-kafka.sh broker-list.sh create-topics.sh /tmp/
 ---> Using cache
 ---> 4a3caaaa856b
Step 9/11 : RUN apk add --no-cache bash curl jq docker  && mkdir /opt  && chmod a+x /tmp/*.sh  && mv /tmp/start-kafka.sh /tmp/broker-list.sh /tmp/create-topics.sh /usr/bin  && sync && /tmp/download-kafka.sh  && tar xfz /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C /opt  && rm /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz  && ln -s /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} /opt/kafka  && rm /tmp/*  && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk  && apk add --no-cache --allow-untrusted glibc-${GLIBC_VERSION}.apk  && rm glibc-${GLIBC_VERSION}.apk
 ---> Running in 6de886aa39ab
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/19) Installing pkgconf (1.3.10-r0)
(2/19) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(3/19) Installing ncurses-terminfo (6.0_p20171125-r0)
(4/19) Installing ncurses-libs (6.0_p20171125-r0)
(5/19) Installing readline (7.0.003-r0)
(6/19) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(7/19) Installing libssh2 (1.8.0-r2)
(8/19) Installing libcurl (7.59.0-r0)
(9/19) Installing curl (7.59.0-r0)
(10/19) Installing libmnl (1.0.4-r0)
(11/19) Installing jansson (2.10-r0)
(12/19) Installing libnftnl-libs (1.0.8-r1)
(13/19) Installing iptables (1.6.1-r1)
(14/19) Installing device-mapper-libs (2.02.175-r0)
(15/19) Installing libltdl (2.4.6-r4)
(16/19) Installing libseccomp (2.3.2-r1)
(17/19) Installing docker (17.12.1-r0)
Executing docker-17.12.1-r0.pre-install
(18/19) Installing oniguruma (6.6.1-r0)
(19/19) Installing jq (1.5-r4)
Executing busybox-1.27.2-r7.trigger
OK: 232 MiB in 69 packages
/bin/sh: illegal option -
Service 'kafka' failed to build: The command '/bin/sh -c apk add --no-cache bash curl jq docker  && mkdir /opt  && chmod a+x /tmp/*.sh  && mv /tmp/start-kafka.sh /tmp/broker-list.sh /tmp/create-topics.sh /usr/bin  && sync && /tmp/download-kafka.sh  && tar xfz /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C /opt  && rm /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz  && ln -s /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} /opt/kafka  && rm /tmp/*  && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk  && apk add --no-cache --allow-untrusted glibc-${GLIBC_VERSION}.apk  && rm glibc-${GLIBC_VERSION}.apk' returned a non-zero code: 2
tenghuanhe commented 6 years ago

Same the condition, could anyone help?

tenghuanhe commented 6 years ago

Hi, @garystafford

I've found the solution, similar to PR#195

Under the project directory, run dos2unix *.sh will fix this problem.

sscaling commented 6 years ago

That PR may fix it - but there have been a number of different build failures on Windows reported, such as https://github.com/wurstmeister/kafka-docker/issues/146 - which has a different error message.

There are also docker compose options such as https://docs.docker.com/compose/reference/envvars/#compose_convert_windows_paths which may help. However, I don't have access to a Windows machine to reproduce and/or verify a fix.

wagnertimo commented 6 years ago

What helped me, since I was cloning the repo, was setting CLRF line endings to false. So I deleted the repo and called git config --global core.autocrlf false And re-cloned it again.

rwagoner commented 5 years ago

Under the project directory, run dos2unix *.sh will fix this problem.

This resolved it for me as well.

zeekrey commented 5 years ago

What helped me, since I was cloning the repo, was setting CLRF line endings to false. So I deleted the repo and called git config --global core.autocrlf false And re-cloned it again.

Worked for me. Thank you! 👍

c-jiang commented 5 years ago

What helped me, since I was cloning the repo, was setting CLRF line endings to false. So I deleted the repo and called git config --global core.autocrlf false And re-cloned it again.

Encountered the same error on Mac, and sorted out my gitconfig was autocrlf=true. After changing it to false, re-clone, and everything goes back correctly.

ammills01 commented 5 years ago

What helped me, since I was cloning the repo, was setting CLRF line endings to false. So I deleted the repo and called git config --global core.autocrlf false And re-cloned it again.

Worked for me!

Velliz commented 5 years ago

I facing this problem. Because i uploaded cloned code from windows machine. But when trying cloned directly in my server (debian 9.5) the issue solved.

Leviafan901 commented 3 years ago

Worked for me too, thanks! https://docs.docker.com/compose/reference/envvars/#compose_convert_windows_paths