You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Skaffold配置中设置构建输出平台为x86_64?

Setting x86_64 (amd64) Platform in Skaffold on M1 Mac

Got it, let's get this sorted for you! Since you're working on an M1 Mac, Skaffold makes it easy to hardcode the linux/amd64 (x86_64) platform directly in your skaffold.yaml—no more typing --platform every time you run a build. Here are the most straightforward ways to do it:

1. Configure Platform for Individual Docker Artifacts

If you only need specific images to target x86_64, set the platforms field inside the docker block of each artifact:

apiVersion: skaffold/v4beta6
kind: Config
build:
  artifacts:
  - image: my-app-image
    docker:
      dockerfile: Dockerfile
      # Explicitly target x86_64 architecture
      platforms: ["linux/amd64"]
  - image: my-sidecar-image
    docker:
      dockerfile: sidecar.Dockerfile
      # Reuse the same platform or set a different one if needed
      platforms: ["linux/amd64"]

2. Set Global Platform for All Artifacts

If every image in your project should build for x86_64, define the platforms field directly under the top-level build section. This applies the setting to all artifacts automatically, saving you from repeating yourself:

apiVersion: skaffold/v4beta6
kind: Config
build:
  # Global platform setting that applies to all build artifacts
  platforms: ["linux/amd64"]
  artifacts:
  - image: my-app-image
    docker:
      dockerfile: Dockerfile
  - image: my-sidecar-image
    docker:
      dockerfile: sidecar.Dockerfile

3. For Docker Buildx Users

If you're using Docker Buildx (the modern default for multi-platform builds), you can explicitly configure it in Skaffold to ensure cross-platform compatibility:

apiVersion: skaffold/v4beta6
kind: Config
build:
  artifacts:
  - image: my-app-image
    docker:
      dockerfile: Dockerfile
      buildx:
        # Use your existing Buildx builder (default works for most cases)
        builder: default
        platforms: ["linux/amd64"]

Quick Pre-Setup Tip

If you haven't set up a multi-platform Buildx builder before, run this once in your terminal to create one:

docker buildx create --use

This creates a builder that supports cross-platform builds, which Skaffold will leverage automatically.

Once you update your skaffold.yaml, any skaffold build or skaffold dev command will build x86_64 images by default—no extra flags required!

内容的提问来源于stack exchange,提问作者Ricky Kazuo Miller

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 00:42:45