These are notes on how to run docker on top of an LVM thin pool, which is nice if your system already has LVM and you have some spare space in the VG.
Tested on Arch. Instruction removes all docker data
so maybe don't do it if you have data you care about?
- Create the thin pool from two LVs: one (larger) for data, the other (smaller) for metadata.
man 7 lvmthin has examples.
- Customize the docker.service systemd unit file to add storage driver args specifying that it should use the thin pool.
systemctl stop docker
rm -rf /var/lib/docker you don't have anything there you want to keep do you?
systemctl edit --full docker.service (much better than the copy / daemon-reload dance).
- Add to the ExecStart line:
-s devicemapper --storage-opt dm.thinpooldev=name-under-dev-mapper and by
name-under-dev-mapper I mean look under your /dev/mapper directory and use the name corresponding to your thin LV (will look like vgname-lvname). Using /dev/vgname/lvname leads to an interesting error.
systemctl start docker
journalctl -e any errors?
Storage Driver: devicemapper
Pool Name: vg_laptop-docker--thinpool
Pool Blocksize: 65.54 kB
Backing Filesystem: xfs
Data Space Used: 21.76 MB
Data Space Total: 21.47 GB
Data Space Available: 21.45 GB
Metadata Space Used: 266.2 kB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.147 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Library Version: 1.02.100 (2015-06-30)
- lvmthin manpage