Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To utilize Docker's Rosetta 2 x86_64 emulation while creating a docker image on an arm64 system architecture, follow these steps:

  1. Install Docker Desktop for Mac on your arm64 system architecture.

  2. Open Terminal on your Mac and run the following command:

    arch -x86_64 /bin/bash
    

    This will switch the Terminal to the x86_64 architecture.

  3. In the x86_64 Terminal, create a new Dockerfile for your image using the "FROM" command to specify the base image that you want to use. For example:

    FROM node:14-alpine
    
  4. Build your Docker image as usual using the "docker build" command. For example:

    docker build -t my-image .
    

    This will build your image using the x86_64 architecture and emulated using Rosetta 2.

  5. After the build is complete, switch back to the arm64 architecture by running the following command:

    arch -arm64 /bin/bash
    
  6. Run your Docker image using the "docker run" command. For example:

    docker run my-image
    

    This will run your image on the arm64 architecture using the emulation provided by Rosetta 2.

Note: This process is specific to Mac environments running on arm64 architecture. Other operating systems or architectures may have different steps or requirements for utilizing Rosetta 2.