exec: use qemu emulator automatically#1516
Merged
AkihiroSuda merged 1 commit intomoby:masterfrom Jun 9, 2020
Merged
Conversation
tiborvass
reviewed
Jun 3, 2020
Dockerfile
Outdated
|
|
||
| FROM scratch AS binaries-linux-helper | ||
| COPY --from=runc /usr/bin/runc /buildkit-runc | ||
| # built from https://github.com/tonistiigi/binfmt/tree/85394e2a1bf0ac9e6c291945e869322bea969445 |
Collaborator
There was a problem hiding this comment.
tiborvass
reviewed
Jun 3, 2020
tiborvass
reviewed
Jun 3, 2020
| } | ||
|
|
||
| emu, err := getEmulator(e.platform, e.cm.IdentityMapping()) | ||
| if err == nil && emu != nil { |
Collaborator
There was a problem hiding this comment.
Log error instead of silencing it
AkihiroSuda
reviewed
Jun 4, 2020
solver/llbsolver/ops/exec_binfmt.go
Outdated
| return []mount.Mount{{ | ||
| Type: "bind", | ||
| Source: filepath.Join(tmpdir, qemuMountName), | ||
| Options: []string{"ro", "rbind"}, |
Member
There was a problem hiding this comment.
Setting ro and rbind together isn't useful because it does not make the mountpoint recursively read-only.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
AkihiroSuda
approved these changes
Jun 8, 2020
tiborvass
approved these changes
Jun 8, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1513
This allows emulation for multi-arch in 6 most popular architectures without kernel being configured with binfmt_misc. If kernel is configured binfmt_misc is used instead.
Currently, all the qemu binaries are included with the image. After gzip for x86 this means ~7MB size increase. https://github.com/tonistiigi/binfmt/releases/tag/test0 That should be ok for most cases. I'm not sure if it is ok for Moby though so maybe we should also allow qemu to be pulled from the image during build. There may be licensing issues as well for shipping these qemu binaries with dockerd.
Another possible optimization would be to avoid cloning emulator binary for each exec. Some cache could be introduced.
The approach of switching entrypoint seems to work on my test builds but lmk if you can spot some possible issues with this.
Signed-off-by: Tonis Tiigi tonistiigi@gmail.com