Skip to content

Commit 2ba655a

Browse files
committed
Add support for mount manager
So that $ nerdctl run --snapshotter=erofs -it --rm docker.1ms.run/library/nginx:latest /bin/sh can work now instead of erroring out as: ``` FATA[0000] failed to mount {Type:format/mkdir/overlay Source:overlay Target: Options:[lowerdir={{ overlay 0 6 }}]} on "/tmp/initialC2844197147": mount source: "overlay", target: "/tmp/initialC2844197147", fstype: format/mkdir/overlay, flags: 0, data: "lowerdir={{ overlay 0 6 }}", err: no such device ``` Signed-off-by: Gao Xiang <[email protected]>
1 parent 8048966 commit 2ba655a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/cmd/container/run_mount.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
173173
return nil, nil, nil, err
174174
}
175175

176+
mm := client.MountManager()
177+
178+
active, err := mm.Activate(ctx, tempDir, mounts)
179+
if err == nil {
180+
defer mm.Deactivate(ctx, tempDir)
181+
mounts = active.System
182+
} else if !errors.Is(err, errdefs.ErrNotImplemented) {
183+
return nil, nil, nil, fmt.Errorf("failed to activate mounts: %w", err)
184+
}
185+
176186
// windows has additional steps for mounting see
177187
// https://github.com/containerd/containerd/commit/791e175c79930a34cfbb2048fbcaa8493fd2c86b
178188
unmounter := func(tempDir string) {

0 commit comments

Comments
 (0)