Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container specific disk quota

Tags:

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?

like image 928
Ningappa Avatar asked Jul 23 '16 13:07

Ningappa


People also ask

How do I limit the memory of a docker container?

To limit the maximum amount of memory usage for a container, add the --memory option to the docker run command. Alternatively, you can use the shortcut -m . Within the command, specify how much memory you want to dedicate to that specific container.

Do Docker containers have a memory limit?

Docker can enforce hard memory limits, which allow the container to use no more than a given amount of user or system memory, or soft limits, which allow the container to use as much memory as it needs unless certain conditions are met, such as when the kernel detects low memory or contention on the host machine.

How much disk space is a docker container using?

Storage Driver By default, each container is set to have 10GB of disk size. For OpenDJ containers, this may not be large enough. There are two ways to increase the container disk size: Set the option globally in /etc/docker/daemon.

Does Docker limit memory by default?

Docker does not apply memory limitations to containers by default. The Host's Kernel Scheduler determines the capacity provided to the Docker memory. This means that in theory, it is possible for a Docker container to consume the entire host's memory.


1 Answers

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.

Relevant docs link.

like image 126
johnharris85 Avatar answered Sep 28 '22 04:09

johnharris85