Podman 4.x から 5.x へのアップグレード(Windows)


はじめに

winget でアップグレードしたら podman machine start 以下のようなエラーとなった。

Error: unable to load machine config file: "json: cannot unmarshal string into Go struct field MachineConfig.ImagePath of type define.VMFile"

Podman 5 machine は Podman 4 machine と互換性が無いとのこと。

コンテナを削除できる場合は、以下のようにアナウンスされている。

Podman 5にアップグレードする前に、Podman 4 の machine をすべて削除してください。Podman 5にアップグレードした後は、新しい podman machine reset コマンドの実行を検討してください。

コンテナを継続して利用する必要がある場合は、別途移行作業が必要。


Podman 4.x to 5.x

こちらを参考に Podman 4 の machine を削除していく。

github.com

Podman 4 のアンインストール前に PowerShell プロンプト以下を実行

podman system connection rm podman-machine-default
podman system connection rm podman-machine-default-root
wsl --list --all
wsl --unregister podman-machine-default

%USERPROFILE%\.ssh\ の中の podman ssh キーを全て削除

  • podman-machine-default
  • podman-machine-default.pub

Podman 4 のアンインストール

winget rm RedHat.Podman

%USERPROFILE%\.config\containers\podman\machine\wsl の中の全てのファイルを削除

  • podman-machine-default.json
  • podman-machine-default.lock

Podman 5 のインストール

winget add RedHat.Podman

以下のコマンドを再度実行

podman system connection rm podman-machine-default
podman system connection rm podman-machine-default-root

machine の初期化

podman machine init

これで machine を起動できるようになった。

podman machine start