Clarify size and virtual size

This commit is contained in:
Misty Stanley-Jones
2017-06-13 13:33:50 -07:00
committed by Misty Stanley-Jones
parent 6ce614ea12
commit 11fcbcb88a

View File

@@ -72,6 +72,39 @@ writable container layer. Each storage driver handles the implementation
differently, but all drivers use stackable image layers and the copy-on-write
(CoW) strategy.
## Container size on disk
To view the approximate size of a running container, you can use the `docker ps`
command. Two different columns relate to size.
- `size`: the amount of data (on disk) that is used for the writable layer of
each container
- `virtual size`: the amount of data used for the read-only image data
used by the container. Multiple containers may share some or all read-only
image data. Two containers started from the same image share 100% of the
read-only data, while two containers with different images which have layers
in common share those common layers. Therefore, you can't just total the
virtual sizes. This will over-estimate the total disk usage by a potentially
non-trivial amount.
The total disk space used by all of the running containers on disk is some
combination of each container's `size` and the `virtual size` values. If
multiple containers have exactly the same `virtual size`, they are likely
started from the same exact image.
This also does not count the following additional ways a container can take up
disk space:
- Disk space used for log files if you use the `json-file` logging driver. This
can be non-trivial if your container generates a large amount of logging data
and log rotation is not configured.
- Volumes and bind mounts used by the container.
- Disk space used for the container's configuration files, which are typically
small.
- Memory written to disk (if swapping is enabled).
- Checkpoints, if you're using the experimental checkpoint/restore feature.
## The copy-on-write (CoW) strategy
Copy-on-write is a strategy of sharing and copying files for maximum efficiency.