Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
configure containerd config with remote snapshotter
Add remote snapshot annotations and transfer unpack config
for stargz, soci, and fuse-overlayfs snapshotter plugins.

Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
  • Loading branch information
ChengyuZhu6 committed Dec 3, 2025
commit b4c6c8fd3119ce8000805110199b670dd3b55e12
9 changes: 9 additions & 0 deletions Dockerfile.d/etc_containerd_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ version = 2
[proxy_plugins.stargz]
type = "snapshot"
address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock"
[proxy_plugins.stargz.exports]
root = "/var/lib/containerd-stargz-grpc/"
enable_remote_snapshot_annotations = "true"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlayfs"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if this config is not specified?
i.e., what happens with the default config?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, it would be

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
  platform = "linux/amd64"(matches the host's OS/Architecture)
  snapshotter = "overlayfs" 
  differ = "walking"     

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
18 changes: 18 additions & 0 deletions Dockerfile.d/test-integration-etc_containerd_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,26 @@ version = 2
[proxy_plugins.stargz]
type = "snapshot"
address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock"
[proxy_plugins.stargz.exports]
root = "/var/lib/containerd-stargz-grpc/"
enable_remote_snapshot_annotations = "true"

# Enable soci snapshotter
[proxy_plugins.soci]
type = "snapshot"
address = "/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock"
[proxy_plugins.soci.exports]
root = "/var/lib/soci-snapshotter-grpc"
enable_remote_snapshot_annotations = "true"

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlayfs"

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "soci"

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
9 changes: 9 additions & 0 deletions Dockerfile.d/test-integration-rootless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ else
[proxy_plugins."stargz"]
type = "snapshot"
address = "/run/user/$(id -u)/containerd-stargz-grpc/containerd-stargz-grpc.sock"
[proxy_plugins.stargz.exports]
root = "/home/rootless/.local/share/containerd-stargz-grpc/"
enable_remote_snapshot_annotations = "true"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlayfs"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
EOF
systemctl --user restart containerd.service
containerd-rootless-setuptool.sh -- install-ipfs --init --offline # offline ipfs daemon for testing
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ Advanced features:

- [`./docs/stargz.md`](./docs/stargz.md): Lazy-pulling using Stargz Snapshotter
- [`./docs/nydus.md`](./docs/nydus.md): Lazy-pulling using Nydus Snapshotter
- [`./docs/soci.md`](./docs/soci.md): Lazy-pulling using SOCI Snapshotter
- [`./docs/overlaybd.md`](./docs/overlaybd.md): Lazy-pulling using OverlayBD Snapshotter
- [`./docs/ocicrypt.md`](./docs/ocicrypt.md): Running encrypted images
- [`./docs/gpu.md`](./docs/gpu.md): Using GPUs inside containers
Expand Down
5 changes: 5 additions & 0 deletions docs/nydus.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Nydus snapshotter is a remote snapshotter plugin of containerd for [Nydus](https
[proxy_plugins.nydus]
type = "snapshot"
address = "/run/containerd-nydus-grpc/containerd-nydus-grpc.sock"

# Optional: Configure nydus for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "nydus"
```

- Launch `containerd` and `containerd-nydus-grpc`
Expand Down
5 changes: 5 additions & 0 deletions docs/overlaybd.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ See https://github.com/containerd/accelerated-container-image to learn further i
[proxy_plugins.overlaybd]
type = "snapshot"
address = "/run/overlaybd-snapshotter/overlaybd.sock"

# Optional: Configure overlaybd for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlaybd"
```

- Launch `containerd` and `overlaybd-snapshotter`
Expand Down
10 changes: 10 additions & 0 deletions docs/rootless.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Then, add the following config to `~/.config/containerd/config.toml`, and run `s
type = "snapshot"
# NOTE: replace "1000" with your actual UID
address = "/run/user/1000/containerd-fuse-overlayfs.sock"

# Optional: Configure fuse-overlayfs for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "fuse-overlayfs"
```

The snapshotter can be specified as `$CONTAINERD_SNAPSHOTTER`.
Expand All @@ -98,6 +103,11 @@ Then, add the following config to `~/.config/containerd/config.toml` and run `sy
type = "snapshot"
# NOTE: replace "1000" with your actual UID
address = "/run/user/1000/containerd-stargz-grpc/containerd-stargz-grpc.sock"

# Optional: Configure stargz for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
```

The snapshotter can be specified as `$CONTAINERD_SNAPSHOTTER`.
Expand Down
5 changes: 5 additions & 0 deletions docs/soci.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ For detailed information about the differences between v1 and v2, see the [SOCI
[proxy_plugins.soci]
type = "snapshot"
address = "/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock"

# Optional: Configure soci for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "soci"
```

- Launch `containerd` and `soci-snapshotter-grpc`
Expand Down
5 changes: 5 additions & 0 deletions docs/stargz.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ See https://github.com/containerd/stargz-snapshotter to learn further informatio
[proxy_plugins.stargz]
type = "snapshot"
address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock"

# Optional: Configure stargz for image unpacking (allows automatic snapshotter selection)
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
```

- Launch `containerd` and `containerd-stargz-grpc`
Expand Down
18 changes: 18 additions & 0 deletions extras/rootless/containerd-rootless-setuptool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,15 @@ cmd_entrypoint_install_fuse_overlayfs() {
[proxy_plugins."fuse-overlayfs"]
type = "snapshot"
address = "${XDG_RUNTIME_DIR}/containerd-fuse-overlayfs.sock"
[proxy_plugins."fuse-overlayfs".exports]
root = "${XDG_DATA_HOME}/containerd-fuse-overlayfs/"
enable_remote_snapshot_annotations = "true"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "fuse-overlayfs"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlayfs"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of complicating the config.
What happens if these lines are missing?
ctr doesn't need them AFAICS?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, it would be

[[plugins."io.containerd.transfer.v1.local".unpack_config]]
  platform = "linux/amd64"(matches the host's OS/Architecture)
  snapshotter = "overlayfs" 
  differ = "walking"     

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config is required to specify which snapshotter the transfer service should use when unpacking images. We define multiple unpack targets:

  • overlayfs for standard OCI images
  • stargz / soci for lazy-pulling support

Without this, containerd defaults to basic unpacking and won't leverage stargz/soci snapshotters needed for lazy-pulling.

And if we only configure stargz in unpack_config, then all images would be forced to use the stargz snapshotter during transfer/unpacking, even standard OCI images that don't support lazy-pulling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add that as comment lines, and update the relevant docs?
What about soci, nydus, etc?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

### END ###
EOT
INFO "Set \`export CONTAINERD_SNAPSHOTTER=\"fuse-overlayfs\"\` to use the fuse-overlayfs snapshotter."
Expand Down Expand Up @@ -449,6 +458,15 @@ cmd_entrypoint_install_stargz() {
[proxy_plugins."stargz"]
type = "snapshot"
address = "${XDG_RUNTIME_DIR}/containerd-stargz-grpc/containerd-stargz-grpc.sock"
[proxy_plugins.stargz.exports]
root = "${XDG_DATA_HOME}/containerd-stargz-grpc/"
enable_remote_snapshot_annotations = "true"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "stargz"
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux"
snapshotter = "overlayfs"
### END ###
EOT
INFO "Set \`export CONTAINERD_SNAPSHOTTER=\"stargz\"\` to use the stargz snapshotter."
Expand Down