Is it possible to limit the size of the hard disk a container can use?
- logging driver
You can limit the amount of disk consumed by the container’s stdout with the logging driver’s options.
For other data, say for a database, the limit is the size of the filesystem mounted for the purpose. You can use a volume or a sized filesystem.
- volume
You can create a volume with limits and mount to your container. The ‘local’ volume driver does not support size limit, apparently. (I cannot find the options for the local volume driver). The ‘tmpfs’ volume driver supports limits, but may be otherwise unsuited. Other volume drivers may support the size limit, but depends on what is available to you.
- Filesystem
You can create a limited file system and bind mount it. This option reduces relocation of the container because the filesystem is a host resource which has to be present on any host the container may run upon.