Merge pull request #7925 from Iceber/content-flow
docs/content-flow: update the description of the content labels
This commit is contained in:
		| @@ -5,7 +5,7 @@ In order to execute on that flow, containerd requires content and to manage it. | ||||
|  | ||||
| This document describes how content flows into containerd, how it is managed, and where it exists | ||||
| at each stage in the process. We use an example of going from a known image | ||||
| [docker.io/library/redis:5.0.9](https://hub.docker.com/layers/redis/library/redis/5.0.9/images/sha256-4ff8940144391ecd5e1632d0c427d95f4a8d2bb4a72b7e3898733352350d9ab3?context=explore) to explore the | ||||
| [docker.io/library/redis:5.0.9](https://hub.docker.com/layers/library/redis/5.0.9/images/sha256-9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b) to explore the | ||||
| flow of content. | ||||
|  | ||||
| ## Content Areas | ||||
| @@ -50,85 +50,85 @@ When we first resolve `redis:5.0.9`, we get the following JSON document: | ||||
|  | ||||
| ```json | ||||
| { | ||||
|   "manifests": [ | ||||
|     { | ||||
|       "digest": "sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "amd64", | ||||
|         "os": "linux" | ||||
|       }, | ||||
|       "size": 1572 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:4ff8940144391ecd5e1632d0c427d95f4a8d2bb4a72b7e3898733352350d9ab3", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "arm", | ||||
|         "os": "linux", | ||||
|         "variant": "v5" | ||||
|       }, | ||||
|       "size": 1573 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:ce541c3e2570b5a05d40e7fc01f87fc1222a701c81f95e7e6f2ef6df1c6e25e7", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "arm", | ||||
|         "os": "linux", | ||||
|         "variant": "v7" | ||||
|       }, | ||||
|       "size": 1573 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:535ee258100feeeb525d4793c16c7e58147c105231d7d05ffc9c84b56750f233", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "arm64", | ||||
|         "os": "linux", | ||||
|         "variant": "v8" | ||||
|       }, | ||||
|       "size": 1573 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:0f3b047f2789547c58634ce88d71c7856999b2afc8b859b7adb5657043984b26", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "386", | ||||
|         "os": "linux" | ||||
|       }, | ||||
|       "size": 1572 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:bfc45f499a9393aef091057f3d067ff7129ae9fb30d9f31054bafe96ca30b8d6", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "mips64le", | ||||
|         "os": "linux" | ||||
|       }, | ||||
|       "size": 1572 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:3198e1f1707d977939154a57918d360a172c575bddeac875cb26ca6f4d30dc1c", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "ppc64le", | ||||
|         "os": "linux" | ||||
|       }, | ||||
|       "size": 1573 | ||||
|     }, | ||||
|     { | ||||
|       "digest": "sha256:24a15cc9366e1557db079a987e63b98a5abf4dee4356a096442f53ddc8b9c7e9", | ||||
|       "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|       "platform": { | ||||
|         "architecture": "s390x", | ||||
|         "os": "linux" | ||||
|       }, | ||||
|       "size": 1573 | ||||
|     } | ||||
|   ], | ||||
|   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", | ||||
|   "schemaVersion": 2 | ||||
|     "manifests": [ | ||||
|         { | ||||
|             "digest": "sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "amd64", | ||||
|                 "os": "linux" | ||||
|             }, | ||||
|             "size": 1572 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:aeb53f8db8c94d2cd63ca860d635af4307967aa11a2fdead98ae0ab3a329f470", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "arm", | ||||
|                 "os": "linux", | ||||
|                 "variant": "v5" | ||||
|             }, | ||||
|             "size": 1573 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:17dc42e40d4af0a9e84c738313109f3a95e598081beef6c18a05abb57337aa5d", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "arm", | ||||
|                 "os": "linux", | ||||
|                 "variant": "v7" | ||||
|             }, | ||||
|             "size": 1573 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:613f4797d2b6653634291a990f3e32378c7cfe3cdd439567b26ca340b8946013", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "arm64", | ||||
|                 "os": "linux", | ||||
|                 "variant": "v8" | ||||
|             }, | ||||
|             "size": 1573 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:ee0e1f8d8d338c9506b0e487ce6c2c41f931d1e130acd60dc7794c3a246eb59e", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "386", | ||||
|                 "os": "linux" | ||||
|             }, | ||||
|             "size": 1572 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:1072145f8eea186dcedb6b377b9969d121a00e65ae6c20e9cd631483178ea7ed", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "mips64le", | ||||
|                 "os": "linux" | ||||
|             }, | ||||
|             "size": 1572 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:4b7860fcaea5b9bbd6249c10a3dc02a5b9fb339e8aef17a542d6126a6af84d96", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "ppc64le", | ||||
|                 "os": "linux" | ||||
|             }, | ||||
|             "size": 1573 | ||||
|         }, | ||||
|         { | ||||
|             "digest": "sha256:d66dfc869b619cd6da5b5ae9d7b1cbab44c134b31d458de07f7d580a84b63f69", | ||||
|             "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|             "platform": { | ||||
|                 "architecture": "s390x", | ||||
|                 "os": "linux" | ||||
|             }, | ||||
|             "size": 1573 | ||||
|         } | ||||
|     ], | ||||
|     "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", | ||||
|     "schemaVersion": 2 | ||||
| } | ||||
| ``` | ||||
|  | ||||
| @@ -144,58 +144,58 @@ linux on amd64, we look for an entry in `manifests` that has a `platform` entry | ||||
| } | ||||
| ``` | ||||
|  | ||||
| This is the first one in the list, and it has the hash of `sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a`. | ||||
| This is the first one in the list, and it has the hash of `sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b`. | ||||
|  | ||||
| We then retrieve the item with that hash, specifically `docker.io/library/redis@sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a` | ||||
| We then retrieve the item with that hash, specifically `docker.io/library/redis@sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b` | ||||
| This gives us the manifest for the image on linux/amd64: | ||||
|  | ||||
| ```json | ||||
| { | ||||
|    "schemaVersion": 2, | ||||
|    "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|    "config": { | ||||
|       "mediaType": "application/vnd.docker.container.image.v1+json", | ||||
|       "size": 6836, | ||||
|       "digest": "sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6" | ||||
|    }, | ||||
|    "layers": [ | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 27098147, | ||||
|          "digest": "sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b" | ||||
|       }, | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 1730, | ||||
|          "digest": "sha256:f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774" | ||||
|       }, | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 1417708, | ||||
|          "digest": "sha256:66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac" | ||||
|       }, | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 7345094, | ||||
|          "digest": "sha256:79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7" | ||||
|       }, | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 99, | ||||
|          "digest": "sha256:de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6" | ||||
|       }, | ||||
|       { | ||||
|          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|          "size": 410, | ||||
|          "digest": "sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b" | ||||
|       } | ||||
|    ] | ||||
|     "schemaVersion": 2, | ||||
|     "mediaType": "application/vnd.docker.distribution.manifest.v2+json", | ||||
|     "config": { | ||||
|         "mediaType": "application/vnd.docker.container.image.v1+json", | ||||
|         "size": 7648, | ||||
|         "digest": "sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a" | ||||
|     }, | ||||
|     "layers": [ | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 27092228, | ||||
|             "digest": "sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90" | ||||
|         }, | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 1732, | ||||
|             "digest": "sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94" | ||||
|         }, | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 1417672, | ||||
|             "digest": "sha256:5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05" | ||||
|         }, | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 7348264, | ||||
|             "digest": "sha256:bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f" | ||||
|         }, | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 98, | ||||
|             "digest": "sha256:fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07" | ||||
|         }, | ||||
|         { | ||||
|             "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", | ||||
|             "size": 409, | ||||
|             "digest": "sha256:97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04" | ||||
|         } | ||||
|     ] | ||||
| } | ||||
| ``` | ||||
|  | ||||
| The `mediaType` tell us that this is a "manifest", and it fits the correct format: | ||||
|  | ||||
| * one `config`, whose hash is `sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6` | ||||
| * one `config`, whose hash is `sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a` | ||||
| * one or more `layers`; in this example, there are 6 layers | ||||
|  | ||||
| Each of these elements - the index, the manifests, the config file and each of the layers - is stored | ||||
| @@ -209,15 +209,15 @@ Each component is stored in a file whose name is the hash of it. | ||||
| Continuing our redis example, if we do `client.Pull()` or `ctr pull`, we will get the following in our | ||||
| content store: | ||||
|  | ||||
| * `sha256:1d0b903e3770c2c3c79961b73a53e963f4fd4b2674c2c4911472e8a054cb5728` - the index | ||||
| * `sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a` - the manifest for `linux/amd64` | ||||
| * `sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6` - the config | ||||
| * `sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b` - layer 0 | ||||
| * `sha256:f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774` - layer 1 | ||||
| * `sha256:66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac` - layer 2 | ||||
| * `sha256:79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7` - layer 3 | ||||
| * `sha256:de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6` - layer 4 | ||||
| * `sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b` - layer 5 | ||||
| * `sha256:2a9865e55c37293b71df051922022898d8e4ec0f579c9b53a0caee1b170bc81c` - the index | ||||
| * `sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b` - the manifest for `linux/amd64` | ||||
| * `sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a` - the config | ||||
| * `sha256:97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04` - layer 0 | ||||
| * `sha256:5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05` - layer 1 | ||||
| * `sha256:bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f` - layer 2 | ||||
| * `sha256:fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07` - layer 3 | ||||
| * `sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90` - layer 4 | ||||
| * `sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94` - layer 5 | ||||
|  | ||||
| If we look in our content store, we see exactly these (I filtered and sorted to make it easier to read): | ||||
|  | ||||
| @@ -225,38 +225,50 @@ If we look in our content store, we see exactly these (I filtered and sorted to | ||||
| $ tree /var/lib/containerd/io.containerd.content.v1.content/blobs | ||||
| /var/lib/containerd/io.containerd.content.v1.content/blobs | ||||
| └── sha256 | ||||
|     ├── 1d0b903e3770c2c3c79961b73a53e963f4fd4b2674c2c4911472e8a054cb5728 | ||||
|     ├── a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a | ||||
|     ├── df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6 | ||||
|     ├── 123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b | ||||
|     ├── f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774 | ||||
|     ├── 66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac | ||||
|     ├── 79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7 | ||||
|     ├── de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6 | ||||
|     └── 602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b | ||||
|     ├── 2a9865e55c37293b71df051922022898d8e4ec0f579c9b53a0caee1b170bc81c | ||||
|     ├── 9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b | ||||
|     ├── 987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a | ||||
|     ├── 97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04 | ||||
|     ├── 5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05 | ||||
|     ├── bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f | ||||
|     ├── fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07 | ||||
|     ├── bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 | ||||
|     └── 1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94 | ||||
| ``` | ||||
|  | ||||
| We can see the same thing if we use the containerd interface. Again, we sorted it for consistent easier viewing. | ||||
|  | ||||
| ```console | ||||
| $ ctr content ls | ||||
| DIGEST									SIZE		AGE		LABELS | ||||
| sha256:1d0b903e3770c2c3c79961b73a53e963f4fd4b2674c2c4911472e8a054cb5728	1.862 kB	6 minutes	containerd.io/gc.ref.content.0=sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a,containerd.io/gc.ref.content.1=sha256:4ff8940144391ecd5e1632d0c427d95f4a8d2bb4a72b7e3898733352350d9ab3,containerd.io/gc.ref.content.2=sha256:ce541c3e2570b5a05d40e7fc01f87fc1222a701c81f95e7e6f2ef6df1c6e25e7,containerd.io/gc.ref.content.3=sha256:535ee258100feeeb525d4793c16c7e58147c105231d7d05ffc9c84b56750f233,containerd.io/gc.ref.content.4=sha256:0f3b047f2789547c58634ce88d71c7856999b2afc8b859b7adb5657043984b26,containerd.io/gc.ref.content.5=sha256:bfc45f499a9393aef091057f3d067ff7129ae9fb30d9f31054bafe96ca30b8d6,containerd.io/gc.ref.content.6=sha256:3198e1f1707d977939154a57918d360a172c575bddeac875cb26ca6f4d30dc1c,containerd.io/gc.ref.content.7=sha256:24a15cc9366e1557db079a987e63b98a5abf4dee4356a096442f53ddc8b9c7e9 | ||||
| sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a	1.572 kB	6 minutes	containerd.io/gc.ref.content.2=sha256:f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774,containerd.io/gc.ref.content.3=sha256:66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac,containerd.io/gc.ref.content.4=sha256:79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7,containerd.io/gc.ref.content.5=sha256:de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6,containerd.io/gc.ref.content.6=sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b,containerd.io/gc.ref.content.0=sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6,containerd.io/gc.ref.content.1=sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b | ||||
| sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6	6.836 kB	6 minutes	containerd.io/gc.ref.snapshot.overlayfs=sha256:87806a591ce894ff5c699c28fe02093d6cdadd6b1ad86819acea05ccb212ff3d | ||||
| sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b	27.1 MB		6 minutes	containerd.io/uncompressed=sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc | ||||
| sha256:f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774	1.73 kB		6 minutes	containerd.io/uncompressed=sha256:b5a8df342567aa93d568b263b25c1eaf52655f0952e1911742ffb4f7a521e044 | ||||
| sha256:66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac	1.418 MB	6 minutes	containerd.io/uncompressed=sha256:c03c7e9701eb61f1e2232f6d19faa699cd9d346207aaf4f50d84b1e37bbad3e2 | ||||
| sha256:79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7	7.345 MB	6 minutes	containerd.io/uncompressed=sha256:367024e4e00618a9ada3203b5922d3186a0aa6136a1c4cbf5ed380171e1afe48 | ||||
| sha256:de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6	99 B		6 minutes	containerd.io/uncompressed=sha256:60ef3ee42de712ef7748cc8e92192e926180b1be6fec9580933f1347fb6b2747 | ||||
| sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b	410 B		6 minutes	containerd.io/uncompressed=sha256:bab68e5155b7010010964bf3aadc30e4a9c625701314ff6fa3c143c72f0aeb9c | ||||
| DIGEST                                                                  SIZE    AGE             LABELS | ||||
| sha256:2a9865e55c37293b71df051922022898d8e4ec0f579c9b53a0caee1b170bc81c 1.862kB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/gc.ref.content.m.0=sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b,containerd.io/gc.ref.content.m.1=sha256:aeb53f8db8c94d2cd63ca860d635af4307967aa11a2fdead98ae0ab3a329f470,containerd.io/gc.ref.content.m.2=sha256:17dc42e40d4af0a9e84c738313109f3a95e598081beef6c18a05abb57337aa5d,containerd.io/gc.ref.content.m.3=sha256:613f4797d2b6653634291a990f3e32378c7cfe3cdd439567b26ca340b8946013,containerd.io/gc.ref.content.m.4=sha256:ee0e1f8d8d338c9506b0e487ce6c2c41f931d1e130acd60dc7794c3a246eb59e,containerd.io/gc.ref.content.m.5=sha256:1072145f8eea186dcedb6b377b9969d121a00e65ae6c20e9cd631483178ea7ed,containerd.io/gc.ref.content.m.6=sha256:4b7860fcaea5b9bbd6249c10a3dc02a5b9fb339e8aef17a542d6126a6af84d96,containerd.io/gc.ref.content.m.7=sha256:d66dfc869b619cd6da5b5ae9d7b1cbab44c134b31d458de07f7d580a84b63f69 | ||||
| sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b 1.572kB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/gc.ref.content.config=sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a,containerd.io/gc.ref.content.l.0=sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90,containerd.io/gc.ref.content.l.1=sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94,containerd.io/gc.ref.content.l.2=sha256:5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05,containerd.io/gc.ref.content.l.3=sha256:bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f,containerd.io/gc.ref.content.l.4=sha256:fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07,containerd.io/gc.ref.content.l.5=sha256:97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04 | ||||
| sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a 7.648kB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/gc.ref.snapshot.overlayfs=sha256:33bd296ab7f37bdacff0cb4a5eb671bcb3a141887553ec4157b1e64d6641c1cd | ||||
| sha256:97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04 409B    20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:d442ae63d423b4b1922875c14c3fa4e801c66c689b69bfd853758fde996feffb | ||||
| sha256:5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05 1.418MB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:223b15010c47044b6bab9611c7a322e8da7660a8268949e18edde9c6e3ea3700 | ||||
| sha256:bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f 7.348MB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:b96fedf8ee00e59bf69cf5bc8ed19e92e66ee8cf83f0174e33127402b650331d | ||||
| sha256:fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07 98B     20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:aff00695be0cebb8a114f8c5187fd6dd3d806273004797a00ad934ec9cd98212 | ||||
| sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 27.09MB 19 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:d0fe97fa8b8cefdffcef1d62b65aba51a6c87b6679628a2b50fc6a7a579f764c | ||||
| sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94 1.732kB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:832f21763c8e6b070314e619ebb9ba62f815580da6d0eaec8a1b080bd01575f7 | ||||
| ``` | ||||
|  | ||||
| #### Labels | ||||
|  | ||||
| Note that each chunk of content has several labels on it. This sub-section describes the labels. | ||||
| Note that each blob of content has several labels on it. This sub-section describes the labels. | ||||
| This is not intended to be a comprehensive overview of labels. | ||||
|  | ||||
| #### Common Labels | ||||
| For images pulled from remotes, the `containerd.io.distribution.source.<registry>=[<repo/1>,<repo/2>]` label | ||||
| is added to each blob of the image to indicate its source. | ||||
| ``` | ||||
| containerd.io/distribution.source.docker.io=library/redis | ||||
| ``` | ||||
|  | ||||
| If the blob is shared by different repos in the same registry, the repo name will be appended: | ||||
| ``` | ||||
| containerd.io/distribution.source.docker.io=library/redis,myrepo/redis | ||||
| ``` | ||||
|  | ||||
| ##### Layer Labels | ||||
|  | ||||
| We start with the layers themselves. These have only one label: `containerd.io/uncompressed`. These files are | ||||
| @@ -270,22 +282,22 @@ $ cat <file> | gunzip - | sha256sum - | ||||
| For example: | ||||
|  | ||||
| ```console | ||||
| $ cat /var/lib/containerd/io.containerd.content.v1.content/blobs/sha256/602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b | gunzip - | sha256sum - | ||||
| bab68e5155b7010010964bf3aadc30e4a9c625701314ff6fa3c143c72f0aeb9c | ||||
| $ cat /var/lib/containerd/io.containerd.content.v1.content/blobs/sha256/1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94 | gunzip - | sha256sum - | ||||
| 832f21763c8e6b070314e619ebb9ba62f815580da6d0eaec8a1b080bd01575f7 | ||||
| ``` | ||||
|  | ||||
| That aligns precisely with the last layer: | ||||
|  | ||||
| ``` | ||||
| sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b	410 B		6 minutes	containerd.io/uncompressed=sha256:bab68e5155b7010010964bf3aadc30e4a9c625701314ff6fa3c143c72f0aeb9c | ||||
| sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94 1.732kB 20 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:832f21763c8e6b070314e619ebb9ba62f815580da6d0eaec8a1b080bd01575f7 | ||||
| ``` | ||||
|  | ||||
| ##### Config Labels | ||||
|  | ||||
| We have a single config layer, `sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6`. It has a label prefixed with `containerd.io/gc.ref.` indicating | ||||
| We have a single config layer, `sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a`. It has a label prefixed with `containerd.io/gc.ref.` indicating | ||||
| that it is a label that impacts garbage collection. | ||||
|  | ||||
| In this case, the label is `containerd.io/gc.ref.snapshot.overlayfs` and has a value of `sha256:87806a591ce894ff5c699c28fe02093d6cdadd6b1ad86819acea05ccb212ff3d`. | ||||
| In this case, the label is `containerd.io/gc.ref.snapshot.overlayfs` and has a value of `sha256:33bd296ab7f37bdacff0cb4a5eb671bcb3a141887553ec4157b1e64d6641c1cd`. | ||||
|  | ||||
| This is used to connect this config to a snapshot. We will look at that shortly when we discuss snapshots. | ||||
|  | ||||
| @@ -294,18 +306,20 @@ This is used to connect this config to a snapshot. We will look at that shortly | ||||
| The labels on the manifest also begin with `containerd.io/gc.ref`, indicating that they are used to control | ||||
| garbage collection. A manifest has several "children". These normally are the config and the layers. We want | ||||
| to ensure that as long as the image remains around, i.e. the manifest, the children do not get garbage collected. | ||||
| Thus, we have labels referencing each child, `containerd.io/gc.ref.content.<index>`. | ||||
| Thus, we have labels referencing each child: | ||||
| * `containerd.io/gc.ref.content.config` references the config | ||||
| * `containerd.io/gc.ref.content.l.<index>` reference the layers | ||||
|  | ||||
| In our example, the manifest is `sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a`, and the labels are as follows. | ||||
| In our example, the manifest is `sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b`, and the labels are as follows. | ||||
|  | ||||
| ``` | ||||
| containerd.io/gc.ref.content.0=sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6 | ||||
| containerd.io/gc.ref.content.1=sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b | ||||
| containerd.io/gc.ref.content.2=sha256:f2edbd6a658e04d559c1bec36d838006bbdcb39d8fb9033ed43d2014ac497774 | ||||
| containerd.io/gc.ref.content.3=sha256:66960bede47c1a193710cf8bfa7bf5f50bc46374260923df1db1c423b52153ac | ||||
| containerd.io/gc.ref.content.4=sha256:79dc0b596c9027416a627a6237bd080ac9d87f92b60f1ce145c566632839bce7 | ||||
| containerd.io/gc.ref.content.5=sha256:de36df38e0b6c0e7f29913c68884a0323207c07cd7c1eba71d5618f525ac2ba6 | ||||
| containerd.io/gc.ref.content.6=sha256:602cd484ff92015489f7b9cf9cbd77ac392997374b1cc42937773f5bac1ff43b | ||||
| containerd.io/gc.ref.content.config=sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6 | ||||
| containerd.io/gc.ref.content.l.0=sha256:97481c7992ebf6f22636f87e4d7b79e962f928cdbe6f2337670fa6c9a9636f04 | ||||
| containerd.io/gc.ref.content.l.1=sha256:5999b99cee8f2875d391d64df20b6296b63f23951a7d41749f028375e887cd05 | ||||
| containerd.io/gc.ref.content.l.2=sha256:bfee6cb5fdad6b60ec46297f44542ee9d8ac8f01c072313a51cd7822df3b576f | ||||
| containerd.io/gc.ref.content.l.3=sha256:fd36a1ebc6728807cbb1aa7ef24a1861343c6dc174657721c496613c7b53bd07 | ||||
| containerd.io/gc.ref.content.l.4=sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 | ||||
| containerd.io/gc.ref.content.l.5=sha256:1ed3521a5dcbd05214eb7f35b952ecf018d5a6610c32ba4e315028c556f45e94 | ||||
| ``` | ||||
|  | ||||
| These are precisely those children of the manifest - the config and layers - that are stored in our content store. | ||||
| @@ -315,23 +329,23 @@ These are precisely those children of the manifest - the config and layers - tha | ||||
| The labels on the index also begin with `containerd.io/gc.ref`, indicating that they are used to control | ||||
| garbage collection. An index has several "children", i.e. the manifests, one for each platform, as discussed above. | ||||
| We want to ensure that as long as the index remains around, the children do not get garbage collected. | ||||
| Thus, we have labels referencing each child, `containerd.io/gc.ref.content.<index>`. | ||||
| Thus, we have labels referencing each child, `containerd.io/gc.ref.content.m.<index>`. | ||||
|  | ||||
| In our example, the index is `sha256:1d0b903e3770c2c3c79961b73a53e963f4fd4b2674c2c4911472e8a054cb5728`, and the labels are as follows: | ||||
| In our example, the index is `sha256:2a9865e55c37293b71df051922022898d8e4ec0f579c9b53a0caee1b170bc81c`, and the labels are as follows: | ||||
|  | ||||
| ``` | ||||
| containerd.io/gc.ref.content.0=sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a | ||||
| containerd.io/gc.ref.content.1=sha256:4ff8940144391ecd5e1632d0c427d95f4a8d2bb4a72b7e3898733352350d9ab3 | ||||
| containerd.io/gc.ref.content.2=sha256:ce541c3e2570b5a05d40e7fc01f87fc1222a701c81f95e7e6f2ef6df1c6e25e7 | ||||
| containerd.io/gc.ref.content.3=sha256:535ee258100feeeb525d4793c16c7e58147c105231d7d05ffc9c84b56750f233 | ||||
| containerd.io/gc.ref.content.4=sha256:0f3b047f2789547c58634ce88d71c7856999b2afc8b859b7adb5657043984b26 | ||||
| containerd.io/gc.ref.content.5=sha256:bfc45f499a9393aef091057f3d067ff7129ae9fb30d9f31054bafe96ca30b8d6 | ||||
| containerd.io/gc.ref.content.6=sha256:3198e1f1707d977939154a57918d360a172c575bddeac875cb26ca6f4d30dc1c | ||||
| containerd.io/gc.ref.content.7=sha256:24a15cc9366e1557db079a987e63b98a5abf4dee4356a096442f53ddc8b9c7e9 | ||||
| containerd.io/gc.ref.content.m.0=sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b | ||||
| containerd.io/gc.ref.content.m.1=sha256:aeb53f8db8c94d2cd63ca860d635af4307967aa11a2fdead98ae0ab3a329f470 | ||||
| containerd.io/gc.ref.content.m.2=sha256:17dc42e40d4af0a9e84c738313109f3a95e598081beef6c18a05abb57337aa5d | ||||
| containerd.io/gc.ref.content.m.3=sha256:613f4797d2b6653634291a990f3e32378c7cfe3cdd439567b26ca340b8946013 | ||||
| containerd.io/gc.ref.content.m.4=sha256:ee0e1f8d8d338c9506b0e487ce6c2c41f931d1e130acd60dc7794c3a246eb59e | ||||
| containerd.io/gc.ref.content.m.5=sha256:1072145f8eea186dcedb6b377b9969d121a00e65ae6c20e9cd631483178ea7ed | ||||
| containerd.io/gc.ref.content.m.6=sha256:4b7860fcaea5b9bbd6249c10a3dc02a5b9fb339e8aef17a542d6126a6af84d96 | ||||
| containerd.io/gc.ref.content.m.7=sha256:d66dfc869b619cd6da5b5ae9d7b1cbab44c134b31d458de07f7d580a84b63f69 | ||||
| ``` | ||||
|  | ||||
| Notice that there are 8 children to the index, but all of them are for platforms other than ours, `linux/amd64`, | ||||
| and thus only one of them, `sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a` actually is | ||||
| and thus only one of them, `sha256:9bb13890319dc01e5f8a4d3d0c4c72685654d682d568350fd38a02b1d70aee6b` actually is | ||||
| in our content store. That doesn't hurt; it just means that the others will not be garbage collected either. Since | ||||
| they aren't there, they won't be removed. | ||||
|  | ||||
| @@ -357,12 +371,12 @@ easier; it matches the layers from the content store and manifest itself. | ||||
| ```console | ||||
| $ ctr snapshot ls | ||||
| KEY                                                                     PARENT                                                                  KIND | ||||
| sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc                                                                         Committed | ||||
| sha256:c2cba74b5b43db78068241279a3225ca4f9639c17a5f0ce019489ee71b4382a5 sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc Committed | ||||
| sha256:315768cd0d297e3cb707360f8dde646419940b42e055845a160880cf98b5a242 sha256:c2cba74b5b43db78068241279a3225ca4f9639c17a5f0ce019489ee71b4382a5 Committed | ||||
| sha256:13aa829f25ce405c1c5f40e0449b9270ce162ac7e4c2a81359df6fe09f939afd sha256:315768cd0d297e3cb707360f8dde646419940b42e055845a160880cf98b5a242 Committed | ||||
| sha256:814ff1c8753c9cd3942089a2401f1806a1133f27b6875bcad7b7e68846e205e4 sha256:13aa829f25ce405c1c5f40e0449b9270ce162ac7e4c2a81359df6fe09f939afd Committed | ||||
| sha256:87806a591ce894ff5c699c28fe02093d6cdadd6b1ad86819acea05ccb212ff3d sha256:814ff1c8753c9cd3942089a2401f1806a1133f27b6875bcad7b7e68846e205e4 Committed | ||||
| sha256:d0fe97fa8b8cefdffcef1d62b65aba51a6c87b6679628a2b50fc6a7a579f764c                                                                         Committed | ||||
| sha256:2ae5fa95c0fce5ef33fbb87a7e2f49f2a56064566a37a83b97d3f668c10b43d6 sha256:d0fe97fa8b8cefdffcef1d62b65aba51a6c87b6679628a2b50fc6a7a579f764c Committed | ||||
| sha256:a8f09c4919857128b1466cc26381de0f9d39a94171534f63859a662d50c396ca sha256:2ae5fa95c0fce5ef33fbb87a7e2f49f2a56064566a37a83b97d3f668c10b43d6 Committed | ||||
| sha256:aa4b58e6ece416031ce00869c5bf4b11da800a397e250de47ae398aea2782294 sha256:a8f09c4919857128b1466cc26381de0f9d39a94171534f63859a662d50c396ca Committed | ||||
| sha256:bc8b010e53c5f20023bd549d082c74ef8bfc237dc9bbccea2e0552e52bc5fcb1 sha256:aa4b58e6ece416031ce00869c5bf4b11da800a397e250de47ae398aea2782294 Committed | ||||
| sha256:33bd296ab7f37bdacff0cb4a5eb671bcb3a141887553ec4157b1e64d6641c1cd sha256:bc8b010e53c5f20023bd549d082c74ef8bfc237dc9bbccea2e0552e52bc5fcb1 Committed | ||||
| ``` | ||||
|  | ||||
| #### Parents | ||||
| @@ -379,25 +393,25 @@ given on the label `containerd.io/uncompressed`. | ||||
|  | ||||
| Rather the name is the result of applying the layer to the previous one and hashing it. By that logic, the very root | ||||
| of the tree, the first layer, should have the same hash and name as the uncompressed value of the first layer blob. | ||||
| Indeed, it does. The root layer is `sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b` | ||||
| which, when uncompressed, has the value `sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc`, | ||||
| Indeed, it does. The root layer is `sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 ` | ||||
| which, when uncompressed, has the value `sha256:d0fe97fa8b8cefdffcef1d62b65aba51a6c87b6679628a2b50fc6a7a579f764c`, | ||||
| which is the first layer in the snapshot, and also the label on that layer in the content store: | ||||
|  | ||||
| ``` | ||||
| sha256:123275d6e508d282237a22fefa5aef822b719a06496444ea89efa65da523fc4b	27.1 MB		6 minutes	containerd.io/uncompressed=sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc | ||||
| sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 27.09MB 19 minutes      containerd.io/distribution.source.docker.io=library/redis,containerd.io/uncompressed=sha256:d0fe97fa8b8cefdffcef1d62b65aba51a6c87b6679628a2b50fc6a7a579f764c | ||||
| ``` | ||||
|  | ||||
| #### Final Layer | ||||
|  | ||||
| The final, or top, layer, is the point at which you would want to create an active snapshot to start a container. | ||||
| Thus, we would need to track it. This is exactly the label that is placed on the config. In our example, the | ||||
| config is at `sha256:df57482065789980ee9445b1dd79ab1b7b3d1dc26b6867d94470af969a64c8e6` and had the label | ||||
| `containerd.io/gc.ref.snapshot.overlayfs=sha256:87806a591ce894ff5c699c28fe02093d6cdadd6b1ad86819acea05ccb212ff3d`. | ||||
| config is at `sha256:987b553c835f01f46eb1859bc32f564119d5833801a27b25a0ca5c6b8b6e111a` and had the label | ||||
| `containerd.io/gc.ref.snapshot.overlayfs=sha256:33bd296ab7f37bdacff0cb4a5eb671bcb3a141887553ec4157b1e64d6641c1cd`. | ||||
|  | ||||
| Looking at our snapshots, the value of the final layer of the stack is, indeed, that: | ||||
|  | ||||
| ``` | ||||
| sha256:87806a591ce894ff5c699c28fe02093d6cdadd6b1ad86819acea05ccb212ff3d sha256:814ff1c8753c9cd3942089a2401f1806a1133f27b6875bcad7b7e68846e205e4 Committed | ||||
| sha256:33bd296ab7f37bdacff0cb4a5eb671bcb3a141887553ec4157b1e64d6641c1cd sha256:bc8b010e53c5f20023bd549d082c74ef8bfc237dc9bbccea2e0552e52bc5fcb1 Committed | ||||
| ``` | ||||
|  | ||||
| Note as well, that the label on the config in the content store starts with `containerd.io/gc.ref`. This is | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Derek McGowan
					Derek McGowan