For my home network, I am looking at a new server unit, to run the various containers and other things. My previous setup used a Ubuntu x86 instance. I know the majority of the images I use are x86 based and have not really looked much into the ARM world. Until now…
Being an Apple customer, I am wondering if use a Mac Mini M1, do ALL Docker images run as expected? Does this happen via the Rosetta 2 framework? Or some other abstraction layer? What, if anything, needs to change? Can you dual-run the Intel and M1 versions of Docker Desktop on the same unit?
You can run ARM or Intel Docker containers on the Apple M1 Mac with Docker Desktop for Mac M1. I do it all the time. The default, of course, is to run the ARM version but if you use the --platform linux/amd64 parameter Docker will run the Intel version for you.
You can try it with one of my images that I’ve built to run Vagrant with Docker as a provider on Apple M1 Silicon:
docker run --rm -it --platform linux/amd64 rofrano/vagrant-provider:debian bash
That will drop you into a bash shell in an amd64 container.
# uname -a
Linux 694817f598fe 5.10.47-linuxkit #1 SMP PREEMPT Sat Jul 3 21:50:16 UTC 2021 x86_64 GNU/Linux
BTW, I absolutely love my M1 Mac mini for development work. It is blazing fast! I highly recommend getting one.
Hey there! This helped me tremendously, I am developing on my M1 Max MacBook however I ran into an issue when executing. I have a Python docker container running x86_64 (I needed this to be able to use a library that requires the x86_64 architecture) and my code is working. However I ran into issues as i executed my script stating MemoryError this prompted me to leun lscpu within my container when I found that my CPU architecture was set as x86_64 but my CPU op-mode was only 32-bit, for some reason on some level I am only running as 32-bit which restricts the amount of RAM my container can consume I believe
At least it does not work for me
docker run -p 80:8080 swaggerapi/swagger-ui --platform linux/amd64
WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/docker-entrypoint.sh: exec: line 38: illegal option –
That’s an other issue. You made a very common mistake and used --platform linux/amd64 after the image name. Everything after the image name is the parameter of the entrypoint. It will be the part of the command running inside the container. This is why the entrypoint got an “illegal option”. This is the right syntax:
docker run -p 80:8080 --platform linux/amd64 swaggerapi/swagger-ui
Since you referred to the GitHub repository, you should be able to build an image for this architecture. If there is any architecture dependent instruction in the Dockerfiles, you can still use the platform option as mentioned in this topic earlier, exxcept that you probably need --platform linux/amd64. I wouldn’t use that in production but it could be good for testing.
update:
I missed this statement. Now I am not sure I understood you since they do support ARM. Or is there an architecture called AARM? Wasn’t that a typo?
Since my message, I have added the —platform
But it seems that the 16go M1 have been given is short in memory for running a container based on the image. I am continuing my tests
Yes, if you change the CPU architecture, the container has to be emulated. And yes, it can affect performance and sometimes it doesn’t work at all.
Docker Desktop is for development and emulation helps you so you don’t have to buy another computer for the other architecture. If you want to run an application in production, run the Linux container on Linux on the right architecture. Depedning on what the application does, it could run emulated in production, but I wouldn’t do that normally.
Hi @iarc13 , As @rimelek pointed out, there is a slight performance hit because Intel images will run in emulation using QEMU on an ARM based Apple Silicon Mac. It’s usually not a problem for developing.