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

Support amd64 on M1 with docker instance #2422

Closed
Fmstrat opened this issue Jan 31, 2022 · 10 comments
Closed

Support amd64 on M1 with docker instance #2422

Fmstrat opened this issue Jan 31, 2022 · 10 comments

Comments

@Fmstrat
Copy link

Fmstrat commented Jan 31, 2022

What are you trying to do?
Run an amd64 container on an m1 mac:

$ multipass launch --disk 100G --mem 16G --cpus 8 docker
$ multipass alias docker:docker
$ docker run --rm -ti --platform linux/amd64 node:12.18.3-stretch-slim sh
standard_init_linux.go:228: exec user process caused: exec format error

What's your proposed solution?
Support some form of building/running amd64 instances with multipass.

Additional context
There may be a workaround for this based on @Saviq 's comment here: https://discourse.ubuntu.com/t/announcing-the-first-release-candidate-for-apple-m1-support/24445/19 but it does not work natively (nor have I been able to discover the method in the documentation).

Thanks!

@townsend2010
Copy link
Contributor

Hi @Fmstrat,

Currently, Multipass only supports the native architecture of the host it's running on. If you really need to do work, you'll need to use the arm64 Docker image here.

That said, we are currently evaluating running Multipass cross architecture (emulated amd64) on M1. Of course, performance is not good, but we are finding that it may be usable depending on what use case is.

@Saviq
Copy link
Collaborator

Saviq commented Feb 1, 2022

@Fmstrat FWIW this works just fine:

$ docker run --rm -ti --platform linux/arm64 node:12.18.3-stretch-slim sh
Unable to find image 'node:12.18.3-stretch-slim' locally
12.18.3-stretch-slim: Pulling from library/node
...
Status: Downloaded newer image for node:12.18.3-stretch-slim
#

(Why) are you set on amd64 there? Docker should generally be well supported across architectures.

@Fmstrat
Copy link
Author

Fmstrat commented Feb 1, 2022

@Saviq Thanks, but I've got a number of use cases requiring amd64 support. For instance, legacy applications using Meteor are amd64 only. Tableau has no ARM option. Platforms without automation where an image needs to be built and pushed for amd64 direct from a laptop require amd64 compilation. The list goes on ;)

We are able to pull this off with Rancher Desktop and nerdctl, but I'd much prefer our team use multipass going forward (and likely will when it supports the items I'm bringing up).

@Saviq
Copy link
Collaborator

Saviq commented Feb 1, 2022

@Fmstrat ACK, so yeah what @townsend2010 mentioned should help with that, with the performance caveats.

@Saviq
Copy link
Collaborator

Saviq commented Feb 1, 2022

Duplicate of #886

@Saviq Saviq marked this as a duplicate of #886 Feb 1, 2022
@Saviq Saviq closed this as completed Feb 1, 2022
@1l0
Copy link

1l0 commented Apr 5, 2022

@Saviq
It seems that this issue is not a duplicate of #886.
@Fmstrat would like to run amd64 container on the arm64 instance / M1, not on the amd64 instance / M1, right?
FYI former is much faster than latter solution 1.

Footnotes

  1. https://github.com/lima-vm/lima/blob/master/docs/multi-arch.md#fast-mode-intel-containers-on-arm-vm-on-arm-host--arm-containers-on-intel-vm-on-intel-host

@Saviq
Copy link
Collaborator

Saviq commented Apr 5, 2022

@1l0 sure, that is an option, but not something Multipass needs to do anything with. What's described above can be achieved in Multipass in exactly the same way today.

@1l0
Copy link

1l0 commented Apr 6, 2022

@Saviq Fortunately you are right. I've confirmed that it works in Multipass by following methods.

multipass shell docker
sudo apt-get install qemu binfmt-support qemu-user-static
docker run --privileged --rm tonistiigi/binfmt --install all
docker run --platform=amd64 {any-amd64-images}

@Saviq
Copy link
Collaborator

Saviq commented Apr 6, 2022

@1l0 thanks, I just proposed canonical/multipass-blueprints#15 to add this to the docker blueprint:

$ multipass launch docker
Launched: docker

$ multipass exec docker -- docker run --rm amd64/alpine uname -a
Unable to find image 'amd64/alpine:latest' locally
latest: Pulling from amd64/alpine
df9b9388f04a: Pull complete
Digest: sha256:a777c9c66ba177ccfea23f2a216ff6721e78a662cd17019488c417135299cd89
Status: Downloaded newer image for amd64/alpine:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Linux 213bb3a3efb2 5.13.0-35-generic #40-Ubuntu SMP Mon Mar 7 08:06:10 UTC 2022 x86_64 Linux

$ multipass exec docker -- docker run --rm s390x/alpine uname -a
Unable to find image 's390x/alpine:latest' locally
latest: Pulling from s390x/alpine
a27b630f446c: Pull complete
Digest: sha256:0a6a2a45b31cd5e28a366a035185eb75020ec28866957c2cb82422ff68fae065
Status: Downloaded newer image for s390x/alpine:latest
WARNING: The requested image's platform (linux/s390x) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Linux a7198eb46924 5.13.0-35-generic #40-Ubuntu SMP Mon Mar 7 08:06:10 UTC 2022 s390x Linux

$ multipass exec docker -- docker run --rm -ti --platform linux/amd64 node:12.18.3-stretch-slim uname -a
Unable to find image 'node:12.18.3-stretch-slim' locally
12.18.3-stretch-slim: Pulling from library/node
abb454610128: Pull complete
3dfc5a66c517: Pull complete
697a63499efd: Pull complete
bfb71980306a: Pull complete
40432f296115: Pull complete
Digest: sha256:2407e5d5c48bd1831e0815ff49dd09064bc337b41857e4cafa8fe39f8a62ae4d
Status: Downloaded newer image for node:12.18.3-stretch-slim
Linux 7100d8b9168e 5.13.0-35-generic #40-Ubuntu SMP Mon Mar 7 08:06:10 UTC 2022 x86_64 GNU/Linux

@msimkunas
Copy link

My use case requires running a very stubborn VPN client that is only built for x86 and requires a display server. While this may be possible by running the client inside a Docker container (although this would really complicate networking since all requests would now have to be routed through this container, if it works at all), this sounds really cumbersome. Being able to run x86 binaries on arm64 Linux would make things much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants