How to build a Docker image for an Arm architecture on a Mac?

I’m trying to figure out how to use Docker’s new beta on my Mac to build an image for a different architecture. Specifically I’m trying to build for Raspberry Pi which uses an Arm processor.

Any ideas?

  • Customize Docker reverse DNS
  • Pull image with docker-compose run
  • How to use vagrant docker-run with container environment variable expansion
  • python3 tkinter ubuntu trusty does not work under virtual environment
  • Docker client freeze
  • How to build docker source code after modifying it?
  • How can I use a variable inside a Dockerfile CMD?
  • How to create a customizable environment that can be rapidly distributed to a local machine?
  • Docker environmental variables as calculated parameters
  • docker run command change to .yaml file
  • Dockerizing java app
  • docker of solr and nutch working together?
  • One Solution collect form web for “How to build a Docker image for an Arm architecture on a Mac?”

    You need to set the GOOS, GOARCH and GOARM environment variables before you build your application:

    export GOOS=linux
    export GOARCH=arm
    export GOARM=6
    go build -o bin/yourapp_arm_6
    

    see: Go environment variables

    Depending on your Raspberry Pi version you must set the GOARM version to 5, 6 or 7.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.