4.7. イメージのタグ付け
podman tag コマンドを使用して、ローカルイメージに別の名前を追加します。この名前は、<registryhost>/<username>/<name>:<tag> のように複数の部分で構成されます。
前提条件
-
container-toolsメタパッケージがインストールされている。 - プルしたイメージがローカルシステムで利用できる。
手順
すべてのイメージをリスト表示します。
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/ubi9/ubi latest 3269c37eae33 7 weeks ago 208 MB以下のいずれかを使用して、
myubi名をregistry.redhat.io/ubi9/ubiイメージに割り当てます。イメージ名:
$ podman tag registry.redhat.io/ubi9/ubi myubiイメージ ID:
$ podman tag 3269c37eae33 myubiどちらのコマンドも、同じ結果になります。
すべてのイメージをリスト表示します。
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/ubi9/ubi latest 3269c37eae33 2 months ago 208 MB localhost/myubi latest 3269c37eae33 2 months ago 208 MBデフォルトのタグがいずれのイメージでも
latestであることに注意してください。すべてのイメージ名が単一のイメージ ID 3269c37eae33 に割り当てられていることを確認できます。以下のいずれかを使用して
registry.redhat.io/ubi9/ubiイメージに9タグを追加します。イメージ名:
$ podman tag registry.redhat.io/ubi9/ubi myubi:9イメージ ID:
$ podman tag 3269c37eae33 myubi:9どちらのコマンドも、同じ結果になります。
すべてのイメージをリスト表示します。
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/ubi9/ubi latest 3269c37eae33 2 months ago 208 MB localhost/myubi latest 3269c37eae33 2 months ago 208 MB localhost/myubi 9 3269c37eae33 2 months ago 208 MBデフォルトのタグがいずれのイメージでも
latestであることに注意してください。すべてのイメージ名が単一のイメージ ID 3269c37eae33 に割り当てられていることを確認できます。
registry.redhat.io/ubi9/ubi イメージにタグ付けした後に、コンテナーを実行するオプションが 3 つあります。
-
ID (
3269c37eae33) -
名前 (
localhost/myubi:latest) -
名前 (
localhost/myubi:9)