-
Notifications
You must be signed in to change notification settings - Fork 310
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 multi-architecture builds in the devcontainer CLI #5652
Comments
Is there any update on this? Indeed hitting issues trying to use a Dev container on an M1 system... having the container build with a forced --platform linux/amd64 would solve that. |
Setting the DOCKER_DEFAULT_PLATFORM environment variable (see https://docs.docker.com/engine/reference/commandline/cli) should work. |
@chrmarti DOCKER_DEFAULT_PLATFORM works for single platform, but not multi-platform as far as I am aware. I believe this does a Here's what the env var does in multi-arch scenarios:
Doing two builds does not really provide a path for multiple architectures to be associated with the same image name. Otherwise, if we don't do that, you need a separate devcontianer.json for ARM vs x86_64 referencing different image names, which is also something we do not support well today. There's a hacky old manifest way of doing this (see "The hard way with docker manifest"), but the goal with this feature request is to have this as a built-in capability given how common it will be for any org with Macs in it. |
@Chuxel Forgot to qualify my suggestion: In @KrisJanssen's case DOCKER_DEFAULT_PLATFORM might work since that appears to only require a single platform. The original feature request cannot be solved with that. Thanks for clarifying. |
Currently, the
devcontainer build
command will build for your current architecture. While this has worked well historically, the arrival of M1 macs has created a challenge particularly for CI systems (that are nearly always running x86) to generate both x86 and arm64 images.To resolve this, we could provide an option that will
buildx
to build multiple architectures (or the equivalant command for other docker-esque clis we end up supporting). However, note that thebuildx --load
option that makes the image available for local use does not support multiple--platform
values today. As a result, if a single platform is specified we can use the load option, otherwise we would not. We can also expose something analogous to--push
to automatically push to image registries.//cc @chrmarti @joshspicer
The text was updated successfully, but these errors were encountered: