When deleting files in a docker container, the DM pool doesn’t free up space

System: long-running container that creates/delete files. Host is a RHEL7.2 (kernel 3.10.0-327.el7.x86_64) machine, with Docer v1.8.2 backed by a “loop-lvm” devicemapper pool.

Symptom: despite the container also deletes files, the available space in the devicemapper pool only shrinks and never increases.

Possible solution: run “fstrim /” from inside the container. Note that this requires you to run it in ‘privileged’ mode.

Advertisements

Tweaking docker devicemapper storage in Red-Hat based distributions

If you are using docker on Red-Hat based distributions, then devicemapper is your default filesystem for backing docker.

In case you want to change some of its default settings (i.e. if pool size of 100Gb is not enough), have a look at the “real docs” for RH7 or at this page for other distributions.

If you want to dig deeper, in this other page you will find a pretty detailed comparison of the different filesystems options available for RH.