Reputation: 1329
Every Docker container will be configured with 10 GB disk space by default, which is the default configuration of devicemapper and it works for all containers. how can I limit inodes or disk quota to the individual container?
For example :
container #1 with disk 10GB and 10000 Inode value
container #2 with disk 20GB and 100000 Inode value
Note : I understand that we can change Default value 10GB by using docker -d--storage-opt
but this applied to each and every containter.
Question : how can I limit inodes or disk quota to the individual container?
Upvotes: 5
Views: 17493
Reputation: 1502
The one thing that always helped me is running
systemctl --user stop docker
systemctl --user start docker
Of course of you have sudo rights you don't need the --user
Upvotes: -1
Reputation: 18926
As of 1.12 this is supported for dm, btrfs and zfs. The syntax is:
$ docker create -it --storage-opt size=120G fedora /bin/bash
Note that the size must (obviously) be above whatever you have set in your daemon opts.
Upvotes: 3
Reputation: 1324935
As commented in issue #16670 (Allow ability to limit disk space available to a container)
Some of the existing volume plugins have the ability to create fixed size volumes out-of-band, which can then be mounted on container run.
Alternately you could consider writing your own volume plugin which allows you to embed the filesize into the volume name.
The older issue 3804 adds:
You should store your data in a volume.
AFAIK, the only Docker storage backend which limits container disk by default is devicemapper. You can configure the daemon to adjust that size, so it's not "stuck" in any real sense.
quotas are now supported in devicemapper, zfs, and btrfs.
Probably won't ever be supported in aufs or overlay.Basically, can set
--storage-opt size=1G
at either the daemon level or at runtime.
So there is no per-container quota yet. There can be for volumes, provided the volume plugin supports it.
Upvotes: 0