0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

imageのDigest指定

Posted at

目的

  • imageのDigest を理解する

手段

killercodaで手を動かす

環境

killercoda

image のダイジェストとは

Docker イメージをダイジェストで指定するには、通常タグを使用する場所に @ 記号を使い、その後にダイジェスト値を記述します。この方法は、イメージの特定のコンテンツを正確に参照したい場合に特に役立ちます。

つまり、タグ指定は <image>:<tag>、ダイジェスト指定は <image>@<digest> ということですね。

ダイジェストの基本的な形式
ダイジェストは、イメージのレイヤーやマニフェストの内容をハッシュ化したものであり、sha256:4d607412e2c07466187740e557b7f941f173c39371725b8979b00755b410f9 のような形式をしています。この値は、イメージのコンテンツが一意であることを保証します。

タグ指定とダイジェスト指定のサンプルは以下の通りです。

- タグ指定:nginx:1.29.1
- ダイジェスト指定:nginx@sha256:eb05700fe7baa6890b74278e39b66b2ed1326831f9ec3ed4bdc6361a4ac2f333

実際にコンテナを作成します。

k run nginx-tag --image=nginx:1.29.1
k run nginx-digest --image=nginx@sha256:eb05700fe7baa6890b74278e39b66b2ed1326831f9ec3ed4bdc6361a4ac2f333

controlplane:~$ k get po
NAME                                READY   STATUS             RESTARTS        AGE
nginx-digest                        1/1     Running            0               11s
nginx-tag                           1/1     Running            0               40s

あとがき

Kubernetes は奥が深い...

ソース

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?