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