-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker's SizeRw does not get updated by runsc #10256
Comments
My guess: gVisor is using an internal overlay filesystem, so writing data modifies process memory instead of the host filesystem. And when |
Might there be any way that we could write data in a way that docker inspect would see it? Like some overlay filesystem configuration? |
I've walked through Docker's code that computes this field and it appears to eventually end up in this If you do want the top overlay layer to live on the host filesystem, you can set the overlay outside of gVisor or Docker, and then expose that to the sandbox as a bind mount. (Of course Docker won't know about it either, but you can then manually track usage because you know where the top of the overlay is.) |
The overlay upper layer (gVisor-internal tmpfs) has a file backend (called "filestore") which lives on the host and hence is scannable by Docker. See "Self-Backed Overlay" section in https://gvisor.dev/blog/2023/05/08/rootfs-overlay/. The overlay filestore is basically a really large-sized file which holds all the pages used by the upper layer. It is a sparse file (it is empty and is populated on demand). When the application creates a new file and writes to it, the size of the filestore file does not change, but its disk usage does. This observable by looking at I think the issue is that the |
While the above are definitely good points, for anyone who runs into similar issues, setting |
Actually https://docs.docker.com/reference/cli/docker/inspect/#size intends to track the size of files, not disk usage. So it is unclear whether a similar containerd fix (containerd/continuity@bc5e3ed) should be applied in this case as well. In the containerd case, we wanted disk usage (as you can see, the functions that were updated were Not sure how useful the size stats are in themselves (since as described above you can have sparse files which can make the container filesystem look really large). But assuming Docker wants that, the |
A friendly reminder that this issue had no activity for 120 days. |
Description
Docker's inspect has a field called
SizeRw
(https://docs.docker.com/reference/cli/docker/inspect/#size) that tracks the amount of bytes changed compared to the base image. This field does not seem to be properly handled by runsc. While doing things like inserting files into the container seems to still properly update this, even when running runsc, having programs write to disk does not seem to be properly tracked by runscSteps to reproduce
Use this Python script:
In this container:
After having run the container, you can observe the SizeRw using
docker inspect --size <container_id>
, where you can retrieve the container id fromdocker ps -a
. The fieldSizeRw
of the response then should be around 10MB, which it is not for runsc.runsc version
docker version (if using docker)
uname
Linux 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC x86_64 x86_64 x86_64 GNU/Linux
kubectl (if using Kubernetes)
No response
repo state (if built from source)
No response
runsc debug logs (if available)
No response
The text was updated successfully, but these errors were encountered: