RHEL9.8 に Podman をインストールする
自分用に整理します。
システムを最新化する
dnf update -y
再起動させるといかのようになりました。この後、IPアドレスなど必要な設定をします。
[root@localhost ~]# rpm -qa |grep release
redhat-release-eula-9.8-1.0.el9.x86_64
redhat-release-9.8-1.0.el9.x86_64
Podman を含む container-tools モジュールを導入
sudo dnf install -y container-tools
- Podman / Buildah / Skopeo がまとめて導入される
- Docker 互換 CLI を使う場合にも便利
Podman 単体のみをインストールしたい場合
dnf install -y podman
インストール確認
podman --version
podman info
- Podman のバージョンが表示されれば OK
- cgroups v2 が有効であることを確認
レジストリ設定を確認(必要に応じて)
[root@localhost ~]# grep ^\unqualified-search-registries /etc/containers/registries.conf
unqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io"]
コンテナストレージの確認
podman info --format '{{.Store.GraphRoot}}'
podman info --format '{{.Store.RunRoot}}'
デフォルトだと以下のように表示される。
[root@localhost ~]# podman info --format '{{.Store.GraphRoot}}'
/var/lib/containers/storage
[root@localhost ~]# podman info --format '{{.Store.RunRoot}}'
/run/containers/storage
イメージはOS全体の場合、「/var/lib/containers/storage/」以下に配置される。rootlessの場合、「~/.local/share/containers/storage/」以下に配置される。
- 変更したい場合
データストアを変更したい場合は、graphrootディレクティブを編集すればいいみたい。
# vi /etc/containers/storage.conf
[root@localhost ~]# grep -v -E "(^$|^#)" /etc/containers/storage.conf
[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"
[storage.options]
additionalimagestores = [
]
[storage.options.pull_options]
enable_partial_images = "false"
[storage.options.overlay]
mountopt = "nodev,metacopy=on"
認証
レポジトリにアクセスするため、認証が必要。アカウント情報はポータルサイトにログインするときと同じ。
podman login registry.redhat.io
podman login docker.io
認証情報は/run/containers/xxx/auth.jsonに保存されていて、永続的ではないみたいです。
以下のように実行する必要があります。
podman login --authfile ~/.config/containers/auth.json registry.redhat.io
podman login --authfile ~/.config/containers/auth.json docker.io
確認
[root@localhost ~]# ls ~/.config/containers/auth.json
/root/.config/containers/auth.json
TEST
podman pull registry.access.redhat.com/ubi9/ubi-minimal
自身のユーザを確認
自分のユーザーに対して、subuid および subgid のマッピングが存在することを確認する
grep "^${USER}:" /etc/subuid
grep "^${USER}:" /etc/subgid
Podmanコマンド
podman ps
podman ps -a
podman images
podman container prune
podman image prune
podman logs <container-id>
podman inspect <container-id>
Dockerとおなじオプションなんでしょうか?Dockerはあまり使ったことないし、Podmanは初めてなのでちょっとわかりません。今後使っていくことで、理解を深めていこうと思います。
参考
https://access.redhat.com/ja/articles/4259601
https://oneuptime.com/blog/post/2026-03-04-install-configure-podman-rhel-9/view?utm_source=copilot.com