containerd / containerd/nerdbox
Transfer to/from container mounts doesn't work
- Dominant language
- Go
- Stars
- 185
- Forks
- 30
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 20
Description
### 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:
https://github.com/containerd/nerdbox/blob/01a93341db3334f9197004e6e4ef6a49365accb7/internal/transfer/containerfs.go#L64-L66
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).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.