c8d/export: Use ref counted mounter
To prevent mounting the container rootfs in a rw mode if it's already mounted. This can't use `mount.WithReadonlyTempMount` because the archive code does a chroot with a pivot_root, which creates a new directory in the rootfs. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
303e2b124e
commit
051d51b222
1 changed files with 7 additions and 2 deletions
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/containerd/containerd/images/archive"
|
||||
"github.com/containerd/containerd/leases"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/mount"
|
||||
cplatforms "github.com/containerd/containerd/platforms"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/container"
|
||||
|
@ -30,7 +29,13 @@ func (i *ImageService) PerformWithBaseFS(ctx context.Context, c *container.Conta
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return mount.WithTempMount(ctx, mounts, fn)
|
||||
path, err := i.refCountMounter.Mount(mounts, c.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer i.refCountMounter.Unmount(path)
|
||||
|
||||
return fn(path)
|
||||
}
|
||||
|
||||
// ExportImage exports a list of images to the given output stream. The
|
||||
|
|
Loading…
Reference in a new issue