4.11. イメージの削除
podman rmi コマンドを使用して、ローカルに保存されたコンテナーイメージを削除します。ID または名前を使用して、イメージを削除できます。
前提条件
-
container-toolsモジュールがインストールされている。
手順
ローカルシステムにある全イメージのリストを表示します。
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/rhel8/rsyslog latest 4b32d14201de 7 weeks ago 228 MB registry.redhat.io/ubi8/ubi latest 3269c37eae33 7 weeks ago 208 MB localhost/myubi X.Y 3269c37eae33 7 weeks ago 208 MBすべてのコンテナーをリスト表示します。
$ podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7ccd6001166e registry.redhat.io/rhel8/rsyslog:latest /bin/rsyslog.sh 6 seconds ago Up 5 seconds ago mysyslogregistry.redhat.io/rhel8/rsyslogイメージを削除するには、podman stopコマンドを使用して、このイメージから実行中のコンテナーをすべて停止する必要があります。コンテナーを ID または名前を使用して停止できます。mysyslogコンテナーを停止します。$ podman stop mysyslog 7ccd6001166e9720c47fbeb077e0afd0bb635e74a1b0ede3fd34d09eaf5a52e9registry.redhat.io/rhel8/rsyslogイメージを削除します。$ podman rmi registry.redhat.io/rhel8/rsyslog複数のイメージを削除するには、以下のコマンドを実行します。
$ podman rmi registry.redhat.io/rhel8/rsyslog registry.redhat.io/ubi8/ubiシステムからすべてのイメージを削除するには、以下のコマンドを実行します。
$ podman rmi -a複数の名前 (タグ) が関連付けられているイメージを削除するには、
-fオプションを追加して削除します。$ podman rmi -f 1de7d7b3f531 1de7d7b3f531...