-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-16373: KIP-1028: Addressing Docker Official Images PR Comments for JVM, Native and Docker Official Images #16664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
67cea41
11521ab
4f68262
2c2b29a
dfd1f19
fee1e30
1de2621
8da6e72
af07079
947ce53
372dacb
d21dff3
ab4a0bf
a82c1fc
1f589a5
f027b78
6d8615f
321fd4d
a63adc4
d08cf6a
89127e0
3d3c915
5c6bfc4
53c75cb
5b54175
92ec952
2e5a354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,58 +18,63 @@ | |
|
|
||
| FROM eclipse-temurin:21-jre-alpine AS build-jsa | ||
|
|
||
| USER root | ||
|
|
||
| # Get kafka from https://archive.apache.org/dist/kafka and pass the url through build arguments | ||
| ARG kafka_url | ||
| ARG GPG_KEY | ||
|
|
||
| COPY jsa_launch /etc/kafka/docker/jsa_launch | ||
|
|
||
| RUN set -eux ; \ | ||
| apk update ; \ | ||
| apk upgrade ; \ | ||
| apk add --no-cache wget gcompat gpg gpg-agent procps bash; \ | ||
| mkdir opt/kafka; \ | ||
| wget -nv -O kafka.tgz "$kafka_url"; \ | ||
| wget -nv -O kafka.tgz.asc "$kafka_url.asc"; \ | ||
| tar xfz kafka.tgz -C /opt/kafka --strip-components 1; \ | ||
| wget -nv -O KEYS https://downloads.apache.org/kafka/KEYS; \ | ||
| gpg --import KEYS; \ | ||
| for server in ha.pool.sks-keyservers.net $(shuf -e \ | ||
| hkp://p80.pool.sks-keyservers.net:80 \ | ||
| keyserver.ubuntu.com \ | ||
| hkp://keyserver.ubuntu.com:80 \ | ||
| pgp.mit.edu \ | ||
| hkp://keys.openpgp.org) ; do \ | ||
| gpg --batch --keyserver "$server" --recv-keys "$GPG_KEY" && break || : ; \ | ||
| done && \ | ||
| gpg --batch --verify kafka.tgz.asc kafka.tgz | ||
|
|
||
| # Generate jsa files using dynamic CDS for kafka server start command and kafka storage format command | ||
| RUN /etc/kafka/docker/jsa_launch | ||
| RUN mkdir opt/kafka; \ | ||
| tar xfz kafka.tgz -C /opt/kafka --strip-components 1; \ | ||
| # Generate jsa files using dynamic CDS for kafka server start command and kafka storage format command | ||
| /etc/kafka/docker/jsa_launch | ||
|
|
||
|
|
||
| FROM eclipse-temurin:21-jre-alpine | ||
|
|
||
| # exposed ports | ||
| EXPOSE 9092 | ||
|
|
||
| USER root | ||
|
|
||
| # Get kafka from https://archive.apache.org/dist/kafka and pass the url through build arguments | ||
| ARG kafka_url | ||
| ARG build_date | ||
| ARG GPG_KEY | ||
|
|
||
|
|
||
| LABEL org.label-schema.name="kafka" \ | ||
| org.label-schema.description="Apache Kafka" \ | ||
| org.label-schema.build-date="${build_date}" \ | ||
| org.label-schema.vcs-url="https://github.com/apache/kafka" \ | ||
| LABEL org.opencontainers.image.title="kafka" \ | ||
| org.opencontainers.image.description="Apache Kafka" \ | ||
| org.opencontainers.image.created="${build_date}" \ | ||
| org.opencontainers.image.source="https://github.com/apache/kafka" \ | ||
| maintainer="Apache Kafka" | ||
|
|
||
| RUN set -eux ; \ | ||
| apk update ; \ | ||
| apk upgrade ; \ | ||
| apk add --no-cache wget gcompat gpg gpg-agent procps bash; \ | ||
| mkdir opt/kafka; \ | ||
| wget -nv -O kafka.tgz "$kafka_url"; \ | ||
| wget -nv -O kafka.tgz.asc "$kafka_url.asc"; \ | ||
| tar xfz kafka.tgz -C /opt/kafka --strip-components 1; \ | ||
| wget -nv -O KEYS https://downloads.apache.org/kafka/KEYS; \ | ||
| gpg --import KEYS; \ | ||
| for server in ha.pool.sks-keyservers.net $(shuf -e \ | ||
| hkp://p80.pool.sks-keyservers.net:80 \ | ||
|
||
| keyserver.ubuntu.com \ | ||
| hkp://keyserver.ubuntu.com:80 \ | ||
| pgp.mit.edu \ | ||
| hkp://keys.openpgp.org) ; do \ | ||
| gpg --batch --keyserver "$server" --recv-keys "$GPG_KEY" && break || : ; \ | ||
| done && \ | ||
| gpg --batch --verify kafka.tgz.asc kafka.tgz; \ | ||
| mkdir opt/kafka; \ | ||
| tar xfz kafka.tgz -C /opt/kafka --strip-components 1; \ | ||
| mkdir -p /var/lib/kafka/data /etc/kafka/secrets; \ | ||
| mkdir -p /etc/kafka/docker /usr/logs /mnt/shared/config; \ | ||
| adduser -h /home/appuser -D --shell /bin/bash appuser; \ | ||
|
|
@@ -79,9 +84,8 @@ RUN set -eux ; \ | |
| cp /opt/kafka/config/log4j.properties /etc/kafka/docker/log4j.properties; \ | ||
| cp /opt/kafka/config/tools-log4j.properties /etc/kafka/docker/tools-log4j.properties; \ | ||
| cp /opt/kafka/config/kraft/server.properties /etc/kafka/docker/server.properties; \ | ||
| rm kafka.tgz kafka.tgz.asc KEYS; \ | ||
| apk del wget gpg gpg-agent; \ | ||
| apk cache clean; | ||
| rm kafka.tgz kafka.tgz.asc; \ | ||
| apk del wget gpg gpg-agent; | ||
|
|
||
| COPY --from=build-jsa kafka.jsa /opt/kafka/kafka.jsa | ||
| COPY --from=build-jsa storage.jsa /opt/kafka/storage.jsa | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "3.7.0": "7C38C2F6E7DF40E527C7C996DE0D9D12FB1360DA", | ||
| "3.7.1": "4687E2BC1319B57B321D6F0E39AB5531A7FCB08E", | ||
| "3.8.0": "CF9500821E9557AEB04E026C05EEA67F87749E61" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try using https://downloads.apache.org/kafka/KEYS for verification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does not work for all versions, so reverting to the original server list approach.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guys from docker hub official won't like external download dependencies - we had that discussion for Storm a few months ago. We workaround that for Apache Storm here: https://github.com/apache/storm-docker/blob/master/automation/create-key-section.sh and here https://github.com/apache/storm-docker/blob/master/2.6.3-jre17/Dockerfile#L40 - might also an option for Kafka ;-)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rzo1 ! Thanks for these suggestions!
A few small queries here:
By this you mean that they wont approve of something along the lines of
correct?
We did receive a comment from the Dockerhub folks regarding this (see Point 5 here).
So we went along and changed the above approach. Now we pass the GPG_KEY as an argument/environment variable, and then use something along the lines of this.
I went through the approach followed by Storm, and that seems like a great way to approach this too. However, for Kafka, there are a lot of existing keys that are returned (see attached image), which might just inflate the length of the Dockerfile (hence we decided with the arg/env approach).
In your experience, do you think the modified approach (here, here and here) would be liked by the Dockerhub folks, or with the discussion you had for Storm, do you anticipate any issue in this approach too?
Thanks a lot again!

Krish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they will just complain, if they don't like it :-) - for Storm, we had one iteration.