From ec231cdcf27b4bfad8fd51dbe4a3a328158aeb86 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Wed, 13 Nov 2024 19:31:58 +0000 Subject: [PATCH] Update ctr to support remapper labels with multiple uid/gid mapping entries Signed-off-by: Henry Wang --- cmd/ctr/commands/run/run_unix.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/ctr/commands/run/run_unix.go b/cmd/ctr/commands/run/run_unix.go index af58ed1c3..492c19d73 100644 --- a/cmd/ctr/commands/run/run_unix.go +++ b/cmd/ctr/commands/run/run_unix.go @@ -175,11 +175,7 @@ func NewContainer(ctx context.Context, client *containerd.Client, cliContext *cl // fuse-overlayfs - https://github.com/containerd/fuse-overlayfs-snapshotter // overlay - in case of idmapped mount points are supported by host kernel (Linux kernel 5.19) if cliContext.Bool("remap-labels") { - // TODO: the optimization code path on id mapped mounts only supports single mapping entry today. - if len(uidSpec) > 1 || len(gidSpec) > 1 { - return nil, errors.New("'remap-labels' option does not support multiple mappings") - } - cOpts = append(cOpts, containerd.WithNewSnapshot(id, image, containerd.WithRemapperLabels(0, uidSpec[0].HostID, 0, gidSpec[0].HostID, uidSpec[0].Size))) + cOpts = append(cOpts, containerd.WithNewSnapshot(id, image, containerd.WithUserNSRemapperLabels(uidSpec, gidSpec))) } else { cOpts = append(cOpts, containerd.WithUserNSRemappedSnapshot(id, image, uidSpec, gidSpec)) }