In Docker 17, how is disk space allocated for containers?

The "base size" limit you see defaulting to 10G is related to the devicemapper storage driver. It doesn't apply to aufs, overlay, overlay2, or other storage drivers. The devicemapper storage driver is commonly used on Red Hat installs.

With aufs, disk is used under /var/lib/docker, you can check for free space there with df -h /var/lib/docker. If you mounted a volume into your container, that disk will be where ever your volume is mounted from. The named volumes default to /var/lib/docker, but other volumes, particularly host volumes, will be located in the directory you specify.

For more details, see:

Selecting a storage driver

Use the device mapper storage driver

Use the aufs storage driver


I'll add for anyone looking for Windows information:

By default, volumes are 20GB and can be changed with --storage-opt "size=50GB".

Source: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-storage

Image size

A common pattern for Windows applications is to query the amount of free disk space before installing or creating new files or as a trigger for cleaning up temporary files. With the goal of maximizing application compatibility the C: drive in a Windows container represents a virtual free size of 20GB. Some users may want to override this default and configure the free space to a smaller or larger value, this can be accomplished though the “size” option within the “storage-opt” configuration. Examples

Command line: docker run --storage-opt "size=50GB" microsoft/windowsservercore:1709 cmd

Docker Configuration File:

"storage-opts": [
    "size=50GB"
  ]

Note that this method works for docker build. See the configure docker document for more details on modifying the docker configuration file.

Tags:

Docker