grepplabs / kafka-proxy

Proxy connections to Kafka cluster. Connect through SOCKS Proxy, HTTP Proxy or to cluster running in Kubernetes.
Apache License 2.0
500 stars 86 forks source link

Can not use grepplabs/kafka-proxy ARM image as base image #163

Open stefan-te opened 8 months ago

stefan-te commented 8 months ago

Hi,

we are using the grepplabs/kafka-proxy image as base image for our own docker image. We were building on amd64 architecture before but want to switch to arm now which leads to errors now. We build our image in AWS CodePipeline and get the following error there:

#6 [2/4] RUN apk update && apk --no-cache add openssl coreutils
#6 0.594 exec /bin/sh: exec format error
#6 ERROR: process "/bin/sh -c apk update && apk --no-cache add openssl coreutils" did not complete successfully: exit code: 1
------
 > [2/4] RUN apk update && apk --no-cache add openssl coreutils:
0.594 exec /bin/sh: exec format error
------
Dockerfile:11
--------------------
   9 |     ENV HTTP_PROXY=$arg_http_proxy
  10 |     
  11 | >>> RUN apk update && apk --no-cache add openssl coreutils
  12 |     
  13 |     ADD ./start.sh ./
--------------------
ERROR: failed to solve: process "/bin/sh -c apk update && apk --no-cache add openssl coreutils" did not complete successfully: exit code: 1

Our Dockerfile looks like this:

FROM --platform=linux/arm64 grepplabs/kafka-proxy@sha256:b73d462d13d49f6281810f5ef481b6aac152193d9fc30913bc512c4977ad1a8b

USER root

ARG arg_https_proxy
ARG arg_http_proxy

ENV HTTPS_PROXY=$arg_https_proxy
ENV HTTP_PROXY=$arg_http_proxy

RUN apk update && apk --no-cache add openssl coreutils

ADD ./start.sh ./
RUN chmod +x ./start.sh

ENTRYPOINT ["/bin/sh", "start.sh"]

So even while we are specifically pull the kafka-proxy ARM image it seems that there are issues with the architecture if you search for this error message.

Locally on an Mac with ARM processor docker build is successful but we noticed that the apk installs from the amd64 repository:

#6 [2/4] RUN apk update && apk --no-cache add openssl coreutils
#6 0.130 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
#6 0.405 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz

So we assume that the alpine base image that is used is somehow not from arm architecture.

Does anyone have an idea how to fix this?

Andreas54321 commented 7 months ago

This is working when updating the kafka-proxy Dockerfile to:

FROM --platform=$BUILDPLATFORM alpine:3.19

Please update the base image :-) Thanks!