【问题标题】:How to build a Docker image for an Arm architecture on a Mac?如何在 Mac 上为 Arm 架构构建 Docker 镜像?
【发布时间】:2016-05-04 18:38:40
【问题描述】:

我正在尝试弄清楚如何在我的 Mac 上使用 Docker 的新测试版为不同的架构构建映像。具体来说,我正在尝试为使用 Arm 处理器的 Raspberry Pi 构建。

有什么想法吗?

【问题讨论】:

标签: macos docker build raspberry-pi pkg-config


【解决方案1】:

您需要在构建应用程序之前设置GOOSGOARCHGOARM 环境变量:

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

见:Go environment variables

根据您的 Raspberry Pi 版本,您必须将 GOARM 版本设置为 5、6 或 7。

【讨论】:

  • 请注意,如果您构建的容器不兼容 ARM,这将不起作用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-19
  • 2017-12-22
  • 1970-01-01
  • 2020-08-09
  • 1970-01-01
  • 2020-10-06
相关资源
最近更新 更多