Skip to content
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

Support for multi-arch (amd64, arm/v7, arm64/v8, ppc64le, s390x) #90

Closed
wants to merge 2 commits into from

Conversation

jonstelly
Copy link

This switches to the adoptopenjdk base image and uses their latest tag to support all the architectures listed above. This should resolve #87, and not mentioned in #87, the current zookeeper tags don't even support arm64, only amd64 because the base openjdk 8-slim tag only supports amd64.

I've built and published the result of this build to the docker hub as kymeric/zookeeper. The sequence to build using docker and buildx:

BUILD

requirements

  • ubuntu 19.10
  • docker 19.03.6 with experimental enabled in daemon and client
  • apt install qemu-user qemu-user-static

steps

docker buildx create --name mp --platform=linux/amd64,linux/arm64/v8,linux/arm/v7,linux/ppc64le,linux/s390x --use
docker buildx inspect mp --bootstrap
docker buildx build --platform=linux/amd64,linux/arm64/v8,linux/arm/v7,linux/ppc64le,linux/s390x -t kymeric/zookeeper:latest --push .

TESTING

kubernetes

I'm testing on arm64 and amd64 in Kubernetes (hybrid kubernetes cluster) by deploying the kafka and zookeeper charts with this command (also uses my custom build of cp-kafka for arm64):

helm install kafka incubator/kafka --set image=kymeric/cp-kafka --set imageTag=latest --set zookeeper.image.repository=kymeric/zookeeper --set zookeeper.image.tag=latest

I'll be testing this over the next few weeks but wanted to start the pull request now to get feedback.

Notes

  • openjdk:8-slim only supports amd64
  • adoptopenjdk:latest supports amd64, arm64, arm/v7, ppc64le, s390x

TODO

  • This includes a switch from openjdk base image to adoptopenjdk image and a bump from jre 8 to jre 11. What testing is required?
  • gosu doesn't work for buildx / qemu-user arm emulation so I switched to su command. Are there issues with this? I don't think gosu is needed for a simple switch user command

- openjdk:8-slim only supports amd64
- adoptopenjdk:latest supports amd64, arm64, arm/v7, ppc64le, s390x

- TODO: This includes a bump from jre 8 to jre 11.  What testing is required?
- TODO: gosu doesn't work for buildx / qemu-user arm emulation so I switched to su command.  Are there issues with this?  I don't think gosu is needed for a simple switch user command

Signed-off-by: Jon Stelly <967068+jonstelly@users.noreply.github.com>
@@ -1,4 +1,4 @@
FROM openjdk:8-jre-slim
FROM adoptopenjdk:latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use tagged release to provide reproducible images

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks. I pinned to 8u232-b09-jre-hotspot (commit: c38c301) which also reduced image size by ~120MB per platform since their latest tag is the jdk instead of the jre.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we're sticking wit jre 8, right? I think it's better to switch to jre 11 later if there any benefits to do so.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any arm images using jre 8 from adoptopenjdk:
https://hub.docker.com/_/adoptopenjdk?tab=tags&page=1&name=-b08-

They do have tar.gz files we could download and extract:
https://adoptopenjdk.net/releases.html

We could also keep things as they are for the zookeeper:latest tag but create another tag, maybe jre11 and/or jre13 and only those tags would be available for arm32/64/etc...?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks. I don't see a stable tag from that repo that is a manifest covering amd64/arm64/....
https://hub.docker.com/r/adoptopenjdk/openjdk8/tags?page=1&name=debianslim-jre
The debianslim-jre tag isn't available for arm64, but their debianslim-jre-nightly is.

Signed-off-by: Jon Stelly <967068+jonstelly@users.noreply.github.com>
@31z4
Copy link
Owner

31z4 commented Feb 16, 2020

Hey @jonstelly thanks for you interest in contributing to Zookeper Docker image!

gosu doesn't work for buildx / qemu-user arm emulation so I switched to su command. Are there issues with this? I don't think gosu is needed for a simple switch user command

Here is an explanation why gosu is needed: #29 (comment)

What testing is required?

Usually I perform smoke testing manually by executing sample instructions from the documentation: https://github.com/docker-library/docs/tree/master/zookeeper
Also, there is a trivial automated test here: https://github.com/docker-library/official-images/blob/master/test/tests/zookeeper-basics/run.sh

@jonstelly
Copy link
Author

re: gosu - Related to the code review conversation, I guess there are a couple things we need to figure out. Mainly, I don't see any openjdk:8 images for arm64. So the options look like:

  • Use a different base image that supports arm64, etc... to stay on jre 8
  • Move to a newer jre which is available for more platforms

Also, if moving to a different jre or base seems risky, we could always keep the current zookeeper:latest tag pointing to the same openjdk jre 8 it uses today, and add one or more new tags and only the new tag(s) would be available for other architectures.

zookeeper:11-jre maybe?

Whether we want to support multiple tags like that or not, it doesn't seem like jre 8 + staying on openjdk as the base image is an option that can support these other architectures.

Personally, basing off of debian:buster-slim would be my preference. I could then extract the important stuff from the openjdk dockerfile and add gosu back from apt.

@31z4
Copy link
Owner

31z4 commented Mar 8, 2020

Also, if moving to a different jre or base seems risky, we could always keep the current zookeeper:latest tag pointing to the same openjdk jre 8 it uses today, and add one or more new tags and only the new tag(s) would be available for other architectures.

Adding more tags would require more time to maintain which I don't have unfortunately.

Personally, basing off of debian:buster-slim would be my preference. I could then extract the important stuff from the openjdk dockerfile and add gosu back from apt.

I don't think we should go that way. I'd rather keep installing java out of the image scope and rely on well maintained java images.

My main concern about switching to AdoptOpenJDK is that I can't find any info about whether or not the HotSpot VM is supported by the upstream. I'm not experienced in Java at all so I don't know how risky is this and not ready to debug VM related issues if any come up.

@agilob
Copy link

agilob commented Mar 8, 2020

AdoptOpenJDK is that I can't find any info about whether or not the HotSpot VM is supported by the upstream

AdoptOpenJDK by default comes with HS, but you can optionally change it to J9, it's right on their homepage https://adoptopenjdk.net/

I'd rather keep installing java out of the image scope and rely on well maintained java images.

AdoptOpenJDK is one of the top players in post java8. Oracle and OpenJDK don't provide very portable builds, best ones to relay now (java8 LTS and java8+) on are Amazon Corretto and AdoptOpenJDK. RedHat OpenJDK also plays a big role, but they got quite late to the party when AOJDK and Corretto had established their positions

https://snyk.io/blog/36-of-developers-switched-from-oracle-jdk-to-an-alternate-openjdk-distribution-over-the-last-year/

@31z4
Copy link
Owner

31z4 commented Mar 8, 2020

AdoptOpenJDK by default comes with HS, but you can optionally change it to J9, it's right on their homepage https://adoptopenjdk.net/

Sorry, by the upstream I meant Zookeeper.

@jonstelly
Copy link
Author

Given the discussion here and completely understandable reluctance to make sweeping JDK changes or take on more complexity, I'm now leaning towards just maintaining my images.

I'll keep them based off of this repo and pick up updates as needed. And if anything changes in the future and you'd like to try and merge things, I'll be happy to coordinate with you and submit a new PR.

Thanks for the discussion. Not being a Java guy, it provided some good context about the current state of JDKs, etc...

Feel free to close this PR if/when you'd like.

@31z4
Copy link
Owner

31z4 commented Dec 31, 2020

Closing it because the PR seems to be inactive for quite some time now.

@31z4 31z4 closed this Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.5 not available for ARM CPUs
3 participants