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

Mixing architectures doesn't work #5314

Closed
1 of 3 tasks
philipahlberg opened this issue Feb 3, 2021 · 5 comments
Closed
1 of 3 tasks

Mixing architectures doesn't work #5314

philipahlberg opened this issue Feb 3, 2021 · 5 comments
Labels
area/m1 M1 preview builds area/multiarch Multi-arch tooling or images lifecycle/locked

Comments

@philipahlberg
Copy link

Using a new M1 MacBook, I tried to build an existing project that had thus far only been used by amd64/x86_64 machines. This project uses Docker Compose to create multiple containers, one of which uses a custom image uploaded to Docker Hub. This custom image only supports amd64. The image boots and runs, but - at least in my case - gives seemingly random compiler errors (see: rust-lang/rust#80346).

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

One of the following would be acceptable:
a) The foreign architecture is properly supported.
b) Docker reports a clear error that the foreign architecture is not supported.

Actual behavior

An image built for an architecture different from the local machine's architecture is downloaded and run, but crashes during operation.

Information

  • macOS Version: 11.2

Steps to reproduce the behavior

  1. Create a new docker-compose.yml file.
  2. In this file, add a service that uses an image from Docker Hub. Ensure that the image is for amd64 (or possibly any architecture other than aarch64).
  3. Run docker-compose build.
  4. Use the container to e. g. compile a program.

I currently don't have a minimal reproducible example, but I can try to set one up if necessary.

Note

I'm wasn't quite sure whether to report this issue here or in docker/compose. Apologies if this is the wrong place.

@philipahlberg
Copy link
Author

Is this a QEMU bug?

@stephen-turner
Copy link
Contributor

Probably. qemu should be able to run containers for the "wrong" architecture, but there are various containers that seem to crash.

@stephen-turner stephen-turner added the area/m1 M1 preview builds label Feb 4, 2021
@djs55
Copy link
Contributor

djs55 commented Feb 12, 2021

@philipahlberg thanks for your report. I also agree it's a qemu emulation bug.

I think the ideal future state is one where most base images are multi-arch supporting both amd64 and arm64. I'm hoping that the popularity of graviton on AWS and Apple Silicon in laptops and desktops will encourage people to build these multi-arch images. These images will obviously run fast and use less memory than images requiring CPU emulation.

In the meantime, qemu's CPU emulation is a handy stopgap. It works for many images, but definitely not all. It's a shame the error messages when it goes wrong are so unclear. Perhaps we could highlight somewhere in the UI when emulation is in progress to warn people in case they see unexpected behaviour?

@djs55 djs55 added the area/multiarch Multi-arch tooling or images label Feb 12, 2021
@stephen-turner
Copy link
Contributor

This is a qemu bug, which is the upstream component we use for running Intel (amd64) containers on M1 (arm64) chips, and is unfortunately not something we control. In general we recommend running arm64 containers on M1 chips because (even ignoring any crashes) they will always be faster and use less memory.

Please encourage the author of this container to supply an arm64 or multi-arch image, not just an Intel one. Now that M1 is a mainstream platform, we think that most container authors will be keen to do this.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/m1 M1 preview builds area/multiarch Multi-arch tooling or images lifecycle/locked
Projects
None yet
Development

No branches or pull requests

4 participants