-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
ARM based docker image #12944
Comments
+1. This would be a good feature for end users. My only concern as a contributor is that it will increase build times. That shouldn't stop this feature, though. Ideally, we'll be able to follow the instructions here: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/. I haven't done a mutli-arch build using maven before (we build our docker images using maven), so that is one nuance. |
I'm glad to work on this if there is nobody already working on it? I've recently created a build job to build amd64/arm64 Docker images for Apache SkyWalking and can apply the experience here, perhaps. |
Thanks @kezhenxu94, I have assigned the issue to you. Looking forward to your PRs. |
I am also interested in support for ARM docker images, especially for testing locally on Apple Silicon based machines |
Thank you @krissetto !! Will let you know when I have a docker image for testing on ARM! |
+1! |
+1 |
Hi all in this thread, I just pushed a multi-arch image to my own repo, anyone interested is welcome to pull and test it in your environment. https://hub.docker.com/repository/docker/kezhenxu94/pulsar/tags?page=1&ordering=last_updated To test, just replace the docker image with
Note this is not official and not well tested now, I'll test, polish and then open a PR so everyone can review on the build process. Any feedback are also welcome and appreciated 🙇 |
I've tested it out, seems to work great. Thanks! |
I have also started testing it on an M1 device, and it seems to work 😄 I haven't gone very deep into it yet though, so i'll be back with feedback if I encounter any specific issues with it. Thanks for the build! Ping when you have a PR too since i'm curious |
Sure, will keep you all in this thread posted. Thanks all for testing. 🙇 |
I can also validate that this appears to work on M1 Pro Max based machine. Would love to see the PR so we can get an official image; this works for local development in the meantime (and eliminates yet another tie to an Intel based machine!). Thanks so much! |
Heads up: The last (hard) step is to build the pulsar client with multiple architectures. Everything else is ready. I have some ideas to build pulsar client in multi architectures but need some time to verify, which may be also ready in 2 weeks (due to public holidays and my personal stuffs) |
@kezhenxu94 thanks for working on this, our company relies on pulsar and a recent move to Mac M1 has led us to run into a ton of problems with local development. Would it be possible to share the Dockerfile so that we could temporarily build arm supported images for older versions of pulsar? If not, do you have a timeline so we can be ready to start switching out our images? |
I can draft a PR of what I've done tomorrow (in my time zone) so that you can try it out. Stay tune please. |
Hi, I've just drafted a PR #14005 |
Are there any updates on this issue? I see the draft PR hasn't changed since last month's revision |
The issue had no activity for 30 days, mark with Stale label. |
For those of you who are stuck at this issue, I was able to create ARM docker images on my M1 Mac by the following simple change. The test dockers from the following builds passed the shade integration test on my laptop.
hsohn@HeesungSohns-MacBook-Pro pulsar % git diff
diff --git a/docker/pulsar/Dockerfile b/docker/pulsar/Dockerfile
index 27fef14fb7..201ca40115 100644
--- a/docker/pulsar/Dockerfile
+++ b/docker/pulsar/Dockerfile
@@ -76,8 +76,12 @@ RUN pip3 install pyyaml==5.4.1
# 4. /pulsar - hadoop writes to this directory
RUN mkdir /pulsar && chmod g+w /pulsar
-ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
-RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
+RUN java_home=$(ls -d1 /usr/lib/jvm/java-17-openjdk-*) ; \
+ ln -s "$java_home" /usr/lib/jvm/java
+
+ENV JAVA_HOME /usr/lib/jvm/java
+RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java/conf/security/java.security
+
ADD target/python-client/ /pulsar/pulsar-client
ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE
diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml
index 048b3da7cb..d4aa4d2eb1 100644
--- a/docker/pulsar/pom.xml
+++ b/docker/pulsar/pom.xml
@@ -75,7 +75,7 @@
<executable>${project.basedir}/../../pulsar-client-cpp/docker/build-wheels.sh</executable>
<arguments>
<!-- build python 3.8 -->
- <argument>3.8 cp38-cp38 manylinux2014 x86_64</argument>
+ <argument>3.8 cp38-cp38 manylinux2014 aarch64</argument>
</arguments>
</configuration>
</execution>
diff --git a/docker/pulsar/scripts/install-pulsar-client.sh b/docker/pulsar/scripts/install-pulsar-client.sh
index 56702b10db..bf81ccad97 100755
--- a/docker/pulsar/scripts/install-pulsar-client.sh
+++ b/docker/pulsar/scripts/install-pulsar-client.sh
@@ -23,3 +23,9 @@ set -x
PYTHON_MAJOR_MINOR=$(python3 -V | sed -E 's/.* ([[:digit:]]+)\.([[:digit:]]+).*/\1\2/')
WHEEL_FILE=$(ls /pulsar/pulsar-client | grep "cp${PYTHON_MAJOR_MINOR}")
pip3 install /pulsar/pulsar-client/${WHEEL_FILE}[all]
+
+# The following `update build-essential python3-dev` are added due to grpcio `cc` not found error
+# TODO: remove these lines if the error got resolved.
+# WARNING: currently grpcio build takes long.
+apt-get update
+apt-get -y install build-essential python3-dev
diff --git a/tests/docker-images/java-test-image/Dockerfile b/tests/docker-images/java-test-image/Dockerfile
index b7f12b7596..99f626f1f6 100644
--- a/tests/docker-images/java-test-image/Dockerfile
+++ b/tests/docker-images/java-test-image/Dockerfile
@@ -40,8 +40,10 @@ RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirr
&& apt-get -y dist-upgrade \
&& apt-get -y install openjdk-17-jdk-headless
-ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
-RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
+RUN java_home=$(ls -d1 /usr/lib/jvm/java-17-openjdk-*) ; \
+ ln -s "$java_home" /usr/lib/jvm/java
+ENV JAVA_HOME /usr/lib/jvm/java
+RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java/conf/security/java.security
# /pulsar/bin/watch-znode.py requires python3-kazoo
# /pulsar/bin/pulsar-managed-ledger-admin requires python3-protobuf
diff --git a/tests/docker-images/latest-version-image/Dockerfile b/tests/docker-images/latest-version-image/Dockerfile
index f5c6726831..d6adb5cfa8 100644
--- a/tests/docker-images/latest-version-image/Dockerfile
+++ b/tests/docker-images/latest-version-image/Dockerfile
@@ -29,8 +29,8 @@ RUN apt-get install -y procps curl git build-essential
ENV GOLANG_VERSION 1.15.8
-RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz \
- | tar -C /usr/local -xz
+RUN export arch=$(uname -m | sed -r 's/aarch64/arm64/g' | awk '!/arm64/{$0="amd64"}1'); \
+curl -sSL https://golang.org/dl/go$GOLANG_VERSION.linux-$arch.tar.gz \
# RUN wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz && tar -xvf go1.13.3.linux-amd64.tar.gz && mv go /usr/local
# RUN export GOROOT=/usr/local/go && export GOPATH=$HOME/go && export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
(END) |
Hi All, I'm interested to learn if I can support this effort. |
Now that #15142 is merged, there are no technical blockers for this work to continue on in the Pulsar project. I'll follow up on this one to try to push this through for the 2.11 release. |
New mailing list thread: https://lists.apache.org/thread/52bncdx2j4j982m9xob85sjmsr23tgzt |
This can be related to #16652 . Also, when I build on Apple M1 (ARM64), I find that
|
Trying to workaround with:
We should integrate this snippet into build scripts, though. FAILED with Python client depends on grpcio = 1.27.2, which doesn't support aarch64. A newer version can help, see also grpc/grpc#25418 and grpc/grpc#21283. cc @BewareMyPower @shibd @RobertIndie After a closer look, it seems the failure is not directly on arch:
Build output:[INFO] --- docker-maven-plugin:0.40.2:build (default) @ pulsar-docker-image --- [INFO] Building tar: /Users/chenzili/Brittani/pulsar/docker/pulsar/target/docker/apachepulsar/pulsar/tmp/docker-build.tar [INFO] DOCKER> [apachepulsar/pulsar:latest]: Created docker-build.tar in 2 seconds [INFO] DOCKER> Step 1/28 : FROM busybox as pulsar [INFO] DOCKER> [INFO] DOCKER> ---> a5ab4ab35b15 [INFO] DOCKER> Step 2/28 : ARG PULSAR_TARBALL [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> f654625fc5f5 [INFO] DOCKER> Step 3/28 : ADD ${PULSAR_TARBALL} / [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 3a10a7f0f465 [INFO] DOCKER> Step 4/28 : RUN mv /apache-pulsar-* /pulsar [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 121b72edf26c [INFO] DOCKER> Step 5/28 : COPY scripts/apply-config-from-env.py /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 29977ea123f6 [INFO] DOCKER> Step 6/28 : COPY scripts/apply-config-from-env-with-prefix.py /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> f3465cf9514c [INFO] DOCKER> Step 7/28 : COPY scripts/gen-yml-from-env.py /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> f33d63ce245d [INFO] DOCKER> Step 8/28 : COPY scripts/generate-zookeeper-config.sh /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> b824025f88bc [INFO] DOCKER> Step 9/28 : COPY scripts/pulsar-zookeeper-ruok.sh /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> be232a3180e8 [INFO] DOCKER> Step 10/28 : COPY scripts/watch-znode.py /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> e1208c4fae8b [INFO] DOCKER> Step 11/28 : COPY scripts/install-pulsar-client.sh /pulsar/bin [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 1de314e3f901 [INFO] DOCKER> Step 12/28 : RUN for SUBDIRECTORY in conf data download logs; do [ -d /pulsar/$SUBDIRECTORY ] || mkdir /pulsar/$SUBDIRECTORY; chmod -R g+w /pulsar/$SUBDIRECTORY; done [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 1482c4534ac8 [INFO] DOCKER> Step 13/28 : RUN chmod g+w /pulsar/lib/presto [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> e7bf9d6530fc [INFO] DOCKER> Step 14/28 : FROM ubuntu:20.04 [INFO] DOCKER> [INFO] DOCKER> ---> eb574ad4e57c [INFO] DOCKER> Step 15/28 : ARG DEBIAN_FRONTEND=noninteractive [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 480737f2b5cc [INFO] DOCKER> Step 16/28 : ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> b93da317a8e6 [INFO] DOCKER> Step 17/28 : RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" /etc/apt/sources.list && echo 'Acquire::http::Timeout "30";\nAcquire::ftp::Timeout "30";\nAcquire::Retries "3";' > /etc/apt/apt.conf.d/99timeout_and_retries && apt-get update && apt-get -y dist-upgrade && apt-get -y install --no-install-recommends openjdk-17-jdk-headless netcat dnsutils less procps iputils-ping python3 python3-kazoo python3-pip curl ca-certificates && apt-get -y --purge autoremove && apt-get autoclean && apt-get clean && rm -rf /var/lib/apt/lists/* [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 953397f00737 [INFO] DOCKER> Step 18/28 : RUN pip3 install pyyaml==5.4.1 [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 0d5d392d05bb [INFO] DOCKER> Step 19/28 : RUN mkdir /pulsar && chmod g+w /pulsar [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 31f147428bde [INFO] DOCKER> Step 20/28 : ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64 [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> dba415d71afe [INFO] DOCKER> Step 21/28 : RUN mkdir -p /usr/lib/jvm/java-17-openjdk-amd64/conf/security [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> d2cf7fef934e [INFO] DOCKER> Step 22/28 : RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security [INFO] DOCKER> [INFO] DOCKER> ---> Using cache [INFO] DOCKER> ---> 83eaa4f453f4 [INFO] DOCKER> Step 23/28 : ADD target/python-client/ /pulsar/pulsar-client [INFO] DOCKER> [INFO] DOCKER> ---> cf055b5ede4f [INFO] DOCKER> Step 24/28 : ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE [INFO] DOCKER> [INFO] DOCKER> ---> Running in 2d90766ce2e2 [INFO] DOCKER> Removing intermediate container 2d90766ce2e2 [INFO] DOCKER> ---> 951081b9ab71 [INFO] DOCKER> Step 25/28 : COPY --from=pulsar /pulsar /pulsar [INFO] DOCKER> [INFO] DOCKER> ---> b9e5fd50bebc [INFO] DOCKER> Step 26/28 : WORKDIR /pulsar [INFO] DOCKER> [INFO] DOCKER> ---> Running in 4a02a04acbe7 [INFO] DOCKER> Removing intermediate container 4a02a04acbe7 [INFO] DOCKER> ---> 01c16f5856d5 [INFO] DOCKER> Step 27/28 : RUN /pulsar/bin/install-pulsar-client.sh [INFO] DOCKER> [INFO] DOCKER> ---> Running in 0e4ed0ece4bb [INFO] DOCKER> [91m++ python3 -V
[INFO] DOCKER> Processing ./pulsar-client/pulsar_client-2.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl [INFO] DOCKER> [91mERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. [INFO] DOCKER> Removing intermediate container 0e4ed0ece4bb |
It seems all the issues are included in #12944 (comment). I'll try it out. |
With #17733 we should be able to build ARM-based docker image manually. Integrating it with automation or CI is another topic. |
if you want to run pulsar standalone without docker you can simply add this to conf/standalone.conf, this will disable RocksDB
|
Since Pulsar 2.11.0, there is no problem in running on ARM64 with default configs |
Any chance to support ARM64 docker in dockerhub? |
As of now, you can build ARM64 image, though we don't yet have multi-arch image. It needs some work on the maven-docker plugin to do so |
How can we run it as a docker standalone ? But I have this error: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested |
I see that warning too, but other than that it works like a charm for me. |
I see this issue was closed (as a PR was merged), when should we expect an ARM image to be available on Dockerhub? We've found that running the amd64 image through qemu is too slow to be useful for our use cases, so are very much looking forward to an ARM image 👀 🙌 |
Yes, this is going to be available in 3.0.0 which is being released this week. |
Is your enhancement request related to a problem? Please describe.
I'd like to see an ARM based docker image for pulsar. The problem is that under new macs the pulsar containers have to be run under emulation which makes them horribly slow.
Describe the solution you'd like
ARM based docker image should be available in the apachepulsar/pulsar repo.
Describe alternatives you've considered
Building a native image has not proved trivial, so ideally someone with more knowledge of the project would be able to create one.
The text was updated successfully, but these errors were encountered: