Debian Codegraph @

docs/pull-modes.md

raw symbols SCIP
1 # Pull modes of the SOCI snapshotter
2
3 The SOCI snapshotter is a remote snapshotter. It is able to lazily load the contents
4 of a container image when a *SOCI index* is present in the remote registry. If
5 a SOCI index is not found, it will download and uncompress the image layers at
6 launch time, just like the default snapshotter does.
7
8 SOCI indices can also be "sparse", meaning that any individual layer may not be
9 indexed. In that case, that layer will be downloaded at launch time, while the
10 indexed layers will be lazily loaded.
11
12 A layer will be mounted as a FUSE mountpoint if it's being lazily loaded, or as
13 a normal overlay layer if it's not.
14
15 Overall, lazily pulling a container image with the SOCI snapshotter
16 (via the `soci image rpull` command) involves the following steps:
17
18 <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19 <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
20
21 - [Pull modes of the SOCI snapshotter](#pull-modes-of-the-soci-snapshotter)
22 - [Step 1: specify SOCI index digest](#step-1-specify-soci-index-digest)
23 - [Step 2: fetch SOCI artifacts](#step-2-fetch-soci-artifacts)
24 - [Step 3: fetch image layers](#step-3-fetch-image-layers)
25
26 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
27
28 ## Step 1: specify SOCI index digest
29
30 To enable lazy pulling and loading an image with the SOCI snapshotter, first you need
31 to `rpull` the image via the [`soci` CLI](./getting-started.md#install-soci-snapshotter).
32 The CLI accepts an optional flag `--soci-index-digest`, which is the sha256 of the
33 SOCI index manifest and will be passed to the snapshotter.
34
35 If not provided, the snapshotter will use the OCI distribution-spec's
36 [Referrers API](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers)
37 (if available, otherwise the spec's
38 [fallback mechanism](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#unavailable-referrers-api))
39 to fetch a list of available indices. An index will be chosen from the list of available indices,
40 but the selection process is undefined and it may not choose the same index every time.
41
42 > **Note**
43 > Check out [this doc](./getting-started.md#lazily-pull-image) for how to
44 > validate if this step is successful or not, and [the debug doc](./debug.md#common-scenarios)
45 > for the common scenarios where `rpull` might fail and how to debug/fix them.
46
47 ## Step 2: fetch SOCI artifacts
48
49 During `rpull`, on the first layer mount there will be an attempt to download
50 and parse the SOCI manifest. If this doesn’t go well, there will be the following
51 error in the log: `unable to fetch SOCI artifacts:`, indicating that the
52 container image will not be lazily loaded. In this case, the snapshotter will
53 fallback to default snapshotter configured (eg: overlayfs) entirely.
54
55 > Check out [the debug doc](./debug.md#common-scenarios) for how to debug/fix it.
56
57 ## Step 3: fetch image layers
58
59 The SOCI index will instruct containerd and the SOCI snapshotter when to fetch/pull
60 image layers. There can be two cases:
61
62 1. There’s no zTOC for a specific layer. In this case, there will be an error log:
63 `{"error":"failed to resolve layer`, indicating that this layer will be
64 synchronously downloaded at launch time.
65 2. There's a zTOC for a specific layer. In this case, the layer will be mounted
66 as a fuse mountpoint, and will be lazily loaded while a container is running.
67
68 > Whether a layer belongs to 1 or 2 depends on its size. When creating a SOCI
69 > index, SOCI only creates zTOC for layers larger than a given size which is
70 > specified by the `--min-layer-size` flag of
71 [`soci create` command](https://github.com/awslabs/soci-snapshotter/blob/9ff88817f3f2635b926f9fd32f6f05f389f7ecee/cmd/soci/commands/create.go#L56).
72
73 With debug logging enabled, you can see an entry in logs for each layer.
74 `checking mount point` indicates that the layer will be lazily loaded.
75 `layer is normal snapshot(overlayfs)` indicates that it will not be lazily loaded.
76
77 ```shell
78 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/17/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
79 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/16/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
80 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/15/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
81 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/13/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
82 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/12/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
83 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/11/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06$
84 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/18/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628108043Z"}
85 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/14/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628124854Z"}
86 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/10/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628164485Z"}
87 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/9/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06:$
88 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/7/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06:$
89 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/6/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06:$
90 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/4/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06:$
91 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/2/fs","msg":"layer is normal snapshot(overlayfs)","time":"2022-08-16T18:06:$
92 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/8/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628307230Z"}
93 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/5/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628321040Z"}
94 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/1/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628348072Z"}
95 {"key":"sha256:5e986c80babd9591530ee7b5844f8f9cca87b991da5dbf0f489f8612228f28f6","level":"debug","mount-point":"/var/lib/soci-snapshotter-grpc/snapshotter/snapshots/3/fs","msg":"checking mount point","time":"2022-08-16T18:06:48.628371627Z"}
96 ```