I know that Docker uses a storage pool to allocate storage to each container. When using devicemapper storage by default the size of the storage pool is 100GB and the default limit of each container is 10G. This data are shown in Base Device Size
and Data Space Total
field in docker info
.
However, in my scenario docker info
do not show these data fields, probably because my storage driver is overlay2
How can I extract this information, is there any other way(s)?
The output of docker info
Containers: 9
Running: 4
Paused: 0
Stopped: 5
Images: 28
Server version: 28
Storage driver: overlay2
Backing filesystem: extfs
Supports d_type: true
Native Overlay diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
...
The output of docker version
Docker version 18.09.3, build 774a1fa
Nope. Devicemapper uses a storage pool. Most of the other union filesystems work at a file level directly in the parent filesystem. Therefore there is no "base device size" or similar metrics showing preallocated blocks and limits.
You can dig deeper into overlay filesystems to understand how they merge directories from the parent filesystem into a new filesystem that you use inside the container. I have an example of working through the overlay filesystem in my intro presentation here:
https://sudo-bmitch.github.io/presentations/docker-intro/presentation.html#52
And the actual commands used to run that overlay demo are listed in this markdown file.
Therefore, all limits you have with containers using something like the overlay2 filesystem are inherited from the parent filesystem. Since docker does everything under /var/lib/docker, your available disk space on that filesystem are the same as the limits you'll see inside of a container. In my own lab, that's symlinked over to a directory under /home, so you'll see the following on the host and inside the container: