LoginSignup
2
0

More than 1 year has passed since last update.

[Podman] M1 Macでamd64用のコンテナイメージを作成する

Posted at

概要と環境

M1 Macを使ってコンテナイメージを作成した際、CPUアーキテクチャの違いが原因でデプロイ先で動作しなかった時の備忘録。環境は以下

OS mac OS Monterey
CPU Apple M1 Pro
Container Runtime Podman 4.1.1

手順

前提としてPodmanはインストール済みとして進める

1. qemu-user-staticのinstall

podman machineを起動する

> podman machine init
> podman machine start

qemu-user-staticのinstall

> podman machine ssh sudo rpm-ostree install qemu-user-static

2. コンテナイメージ作成

--platformオプションを指定することで異なるアーキテクチャに対応させることができる。今回はamd64用なのでamd64を指定する

> podman build .  -t <image名> --platform linux/amd64

複数指定したい場合は以下のように記述する

> podman build .  -t <image名> --platform linux/amd64,linux/arm64
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0