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).
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:
nerdbox/internal/transfer/containerfs.go
Lines 64 to 66 in 01a9334
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).