Setting Docker Container Storage Quota With Overlay And Different Storage Drivers
This article provides a detailed explanation on how to set Docker container storage quota using the --storage-opt
option with overlay on XFS, and offers examples with various storage drivers such as devmapper, zfs, and vfs. Additionally, it guides you through changing the data-root
configuration in /etc/docker/daemon.json
and editing the /etc/fstab
file to further customize your Docker container’s storage settings.
Docker container storage quota
--storage-opt
is supported only for overlay over xfs with ‘pquota’ mount option.
change data-root to somewhere else in /etc/docker/daemon.json
edit /etc/fstab
and add our xfs block on new line (find uuid using blkid)
1 | docker run --storage-opt size=10M --rm -it alpine |
when using devmapper make sure size is greater than 10G (default)
1 | docker run --storage-opt size=11G --r'm -it alpine |
zfs, vfs (not a unionfs, but for testing) storage drivers also supports disk quota. you may use it by changing data-root
to the related storage device.