Repository navigation
Conversation
|
Currently, there is no multiarch building step for Arm64 platform. |
|
@alicefr |
|
@lubinsz thanks to open the PR. I have a couple of suggestions. Instead of using a Dockerfile per architecture, you can use FROM alpine
RUN apk add --no-cache curlyou can now build the arm image on x86 in this way: docker build --platform=linux/arm64 -t image-example:arm64 .In this way, you can generalize and use the same dockerfile for multiple architectures. It is enough to register the binfmt_misc and set |
|
@alicefr |
|
hi, i guess you're missing the qemu-static inside the container. As you're registering with |
|
Instead of using the docker image you could directly use the script ./qemu-binfmt-conf.sh --qemu-path /usr/bin --qemu-suffix "-static" --persistent yes |
|
@alicefr |
|
@lubinszARM it's ok for me. Then you decided to not use the F flag. I find that it's the most elegant solution because you don't have the qemu-static binary inside the docker image. Anyway, that solution has of course some restrictions. Then, if you decide to copy the qemu-static you could remove it at the end of the build time. In this way, you don't have the qemu-static inside the final image. I'd also suggest that you use the |
|
@alicefr |
|
Thanks to address the PR. It solves the problem also for other archs |
|
@alicefr |
|
@bacongobbler @alicefr |
| FROM alpine:3.7 | ||
| FROM BASEIMAGE | ||
|
|
||
| CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ |
There was a problem hiding this comment.
I'm confused here. This is the docker file for the released image isn't it? It should not contain an emulator, as the image should run natively on the target arch.
In general, I'm also a bit confused by including an emulator at all. I thought golang could cross compile all by itself. Greping through the kubernetes code for qemu, they do have qemu in there, but from a superficial skimming of the code, only looks to be used to test the binaries, not build/ship them? Maybe I'm totally wrong.
There was a problem hiding this comment.
Hi @kfox1111
Thank you for your comments. :)
I have added a command to delete the emulator in the end of each Dockerfiles.
Regarding to your second question, you should notice the following line in each Dockerfile:
"RUN apk update && apk add ... "
It means, it needs to execute non-x86 instruction in docker multi-arch building step.
So the emulator in Dockerfile is mandatory.
Regarding to rook/ceph, we don't need to copy emulator in Dockerfile. Because we don't need to run any non-x86 instruction in docker multi-arch building step.
But for rook/nfs, the emulator in Dockerfile is mandatory. The reason for this problem is same as the problem in helm.
You can see that there are many commands in the Dockerfile of ‘rook/nfs' that need to use non-x86 instruction. Such as: 'dnf install', 'make' ...
You can test my patch in your x86 ubuntu environment.
The building will be failed if without the following line in Dockerfile:
"CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/"
The error should be like following:
Step 2/9 : RUN apk update && apk add ca-certificates socat && rm -rf /var/cache/apk/*
---> Running in 02f412954455
standard_init_linux.go:190: exec user process caused "no such file or directory"
The command '/bin/sh -c apk update && apk add ca-certificates socat && rm -rf /var/cache/apk/*' returned a non-zero code: 1
Makefile:120: recipe for target 'docker-build' failed
Introduction article: https://lobradov.github.io/Building-docker-multiarch-images/
Please see the section titled "Different Dockerfile per architecture" as reference.
In addition, I need to explain that these problems have nothing to do with golang cross compilation.
For helm, the problem is that it uses the following command in Dockerfile:
"RUN apk update && apk add ... "
For rook/nfs, the problem is that it uses the following command in Dockerfile:
"RUN dnf install ... make...."
If we only need to simply COPY the cross-compiled golang binary files in Dockerfile, we don't need to COPY the emulator in Dockerfile. Just like in rook/ceph.
There was a problem hiding this comment.
Hmm... I see. thanks for the explanation.
removing the emulator in a subsequent layer will only hide it, not remove it. so it will still be shipped to the end devices anyway.
I was thinking the emulator was fairly sizeable, but it looks like its pretty small compared to tiller so it may not be too bad to ship to machines that never will use it.
There was a problem hiding this comment.
This is a tricky problem @justincormack might have an idea other than the experimental version of Docker? In OpenFaaS we build for amd64, armhf, arm64 but with the two arm platforms built on a device and not via cloud CI. It's a huge pain so we may move to qemu like this.
There was a problem hiding this comment.
You can remove the emulator using a multi-stage build. Cross builds are kind of horrible compared to native, but better than no build...
|
removing from the 2.13 milestone given the current discussions/concerns |
|
Hi @bacongobbler are there any open concerns with the PR at the moment? |
|
@lubinsz it looks like the Makefile has a conflict at the moment, perhaps needs a rebase? |
Yes. Please see #5039 (review). |
@bacongobbler |
Done. |
Hi @bacongobbler |
|
@lubinsz Can you rebase and it should be ready again for review then? |
|
ping @hickeyma @bacongobbler |
Signed-off-by: Bin Lu <[email protected]>
|
Closing for the same reasons in #2649. For posterity: As per the announcement on the mailing list, Helm 2.15.0 is the last release where we will be merging new features for Helm 2. Tiller has been removed in Helm 3 so I don't see us moving forward with this proposal, so I'm going to close this as something we do not plan to merge in the 2.15 timeframe. That being said, the tiller-multiarch project has been providing amd64 tiller images for Helm 2, so I'd suggest focusing efforts on that project going forward. Thanks! |
Signed-off-by: Bin Lu [email protected]