DEV Community

Duncan Ogilvie
Duncan Ogilvie

Posted on • Updated on

Running x86 containers on your M1 Mac with Docker and Rosetta

Installation

First you need to install Rosetta:

softwareupdate --install-rosetta
Enter fullscreen mode Exit fullscreen mode

Then install Docker Desktop (Podman does not support this feature).

After installing Docker you need to change a few settings:

  • General -> Use Virtualization Framework
  • General -> VirtioFS
  • Features in Development -> Use Rosetta for x86/amd64 emulation on Apple Silicon

Creating a container

Now you can create an Ubuntu container:

docker pull --platform linux/amd64 ubuntu:22.04
docker create --platform linux/amd64 --interactive ubuntu:22.04 bash
Enter fullscreen mode Exit fullscreen mode

Now open the Containers section of the Docker Desktop Dashboard and start the newly-created container (it will have a random name). After it started you can click ... -> Open in Terminal to get a shell.

Running a temporary container

To run a container that will be deleted on exit, use the following command:

docker run --platform linux/amd64 --interactive --rm ubuntu:22.04 bash
Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)