Jan 09, 2017 Increase docker container disk space on OS X? Docker Desktop for Mac. Rjurney (Russell Jurney) 2017-01-05 03:54:17 UTC #1. I have created the container rjurney/agiledatascience for running the book Agile Data Science 2.0’s examples. It has mongo, elasticsearch, hadoop, spark, etc. And they all work together.
![](/uploads/1/2/6/7/126748856/824215035.jpg)
I'm trying to sift through a hefty amount of logs with a Splunk container but Splunk is refusing to index them because storage in its container quickly falls below the minimum 5GB Splunk requires to work. I realised the reason for this is that my Splunk container has only 10GB of storage capacity allotted to it. I want to increase this number.Now I've seen how it's done with the devicemapper storage driver. Something on the lines of dockerd -storage-opt dm.basesize=20GBut this option is specific to that driver. Is there an equivalent of this option in overlay2?Any help appreciated!.
Thanks for the help, man. The command you referenced ( -storage-opt) only allows you to resize the partition if the backing filesystem is XFS, which means I won't be able to resize containers in my laptop directly, as it uses ext4. I got around this by using a CentOS Vagrant VM which uses XFS by default and it worked, which is good enough for me.It'd be really interesting to learn what the resize threshold is for overlay2 storage driver, since you mentioned it will grow the partition if I happen to write more than its current capacity would allow. The problem with it not allowing me to pre-emptively resize is that Splunk has a minimum for the amount of free storage you must have in order for it to work.
This minimum can be decreased though, so perhaps I could adjust it around overlay2 resize threshold. Most containers have a default 10GB rootfs size when the container is built, so you'll have to use the -storage-opt to resize that. I've encountered containers that have a 10GB rootfs by default, so it can also be set on build if you're building those containers.
Overlay2 won't resize the rootfs of the container automatically, it just uses the underlying fs of the host so you don't have to configure the storage driver specifically in that case like you do with the devicemapper driver. One option is to just build a xfs partition on your laptop and move storage to that so overlay2 will handle resizing.Generally for these cases I'd use an external volume to decouple the container size from the data size so you can adjust as needed. Keep the rootfs small and make the splunk data dir as large as needed and swappable.
DescriptionOn my system fresh containers see a base device storage size of about 10G. How can I change this size?
I am using the devicemapper backend.I eventually figured it out but I'll document my Solution below. The docker team will probably add useful comments to this.SolutionThe two relevant bits of documentation are, first from:With devicemapper the high level process for creating images is as follows:The devicemapper storage driver creates a thin pool.The pool is created from block devices or loop mounted sparse files (more on this later).Next it creates a base device.A base device is a thin device with a filesystem. You can see which filesystem is in use by running the docker info command and checking the Backing filesystem value.Each new image (and image layer) is a snapshot of this base device.These are thin provisioned copy-on-write snapshots. This means that they are initially empty and only consume space from the pool when data is written to them.and second, this excerpt from documentation:dm.basesizeSpecifies the size to use when creating the base device, which limits the size of images and containers. The default value is 10G. Note, thin devices are inherently “sparse”, so a 10G device which is mostly empty doesn’t use 10 GB of space on the pool. However, the filesystem will use more space for the empty case the larger the device is.The base device size can be increased at daemon restart which will allow all future images and containers (based on those new images) to be of the new base device size.Therefore in order, to grant containers access to, say, 200G of storage space we need to.
Arrange to that the dockerd is started with -storage-opt dm.basesize=200G. Ensure that the container that need to access that much space is created from an image that has been created (e.g.
![Disk Disk](/uploads/1/2/6/7/126748856/670798757.png)
Pulled) after that setting being active.
![](/uploads/1/2/6/7/126748856/824215035.jpg)