Skip to content

Transfer to/from container mounts doesn't work #164

@Kern--

Description

@Kern--

Background

#99 Added support for reading from/writing to containers inside the VM. Callers on the host can use this API to move data across the VM with an intermediary tar stream. However, this does not work if the target inside the vm is part of a mount (bind mount or ext4 mount).

Root cause

The copy implementation (internal/transfer/containerfs.go) always resolves paths against the container's OCI rootfs overlay:

rootfs := filepath.Join(t.bundleDir, d.ContainerID, "rootfs")
r := s.Reader(ctx)
return readPath(r, rootfs, d.Path, s.MediaType, d.PreserveOwnership)

Bind mounts in this architecture are backed by virtiofs, not the overlay filesystem. A path like /data that is bind-mounted inside the container has no corresponding directory under the OCI rootfs/ — it's only reachable through the virtiofs mount inside the VM. A similar problem exists for ext4 mounts.

When copying to a mounted directory, the transfer service writes to/reads from the overlayfs which makes writes invisible to the container (masked by the mount) and reads invisible from the host (the mounts are not accessed at all).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions