Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
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
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
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
2 changes: 1 addition & 1 deletion cmd/nerdctl/container/container_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ func TestRunFromOCIArchive(t *testing.T) {
tarPath := fmt.Sprintf("%s/%s.tar", buildCtx, imageName)

base.Cmd("build", "--tag", tag, fmt.Sprintf("--output=type=oci,dest=%s", tarPath), buildCtx).AssertOK()
base.Cmd("run", "--rm", fmt.Sprintf("oci-archive://%s", tarPath)).AssertOutContainsAll(fmt.Sprintf("Loaded image: %s", tag), sentinel)
base.Cmd("run", "--rm", fmt.Sprintf("oci-archive://%s", tarPath)).AssertOutContainsAll(tag, sentinel)
}

func TestRunDomainname(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions cmd/nerdctl/image/image_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package image

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -61,7 +60,7 @@ func TestLoadStdinFromPipe(t *testing.T) {
identifier := data.Identifier()
return &test.Expected{
Output: expect.All(
expect.Contains(fmt.Sprintf("Loaded image: %s:latest", identifier)),
expect.Contains(identifier),
func(stdout string, t tig.T) {
assert.Assert(t, strings.Contains(helpers.Capture("images"), identifier))
},
Expand Down Expand Up @@ -107,7 +106,7 @@ func TestLoadQuiet(t *testing.T) {
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
return &test.Expected{
Output: expect.All(
expect.Contains(fmt.Sprintf("Loaded image: %s:latest", data.Identifier())),
expect.Contains(data.Identifier()),
expect.DoesNotContain("Loading layer"),
),
}
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
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
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
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
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
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
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
Loading
Loading