docker-lvm
Table of Contents
Docker & LVM
Install prerequisites
apt-get install -y lvm2 thin-provisioning-tools && reboot
Set variables
export device=/dev/xvdf export vgname=docker export lvname=thinpool
Create physical Volume
pvcreate $device
Create volume group
vgcreate $vgname $device
Create logical volumes
lvcreate --wipesignatures y -n ${lvname} ${vgname} -l 95%VG lvcreate --wipesignatures y -n ${lvname}meta ${vgname} -l 1%VG
Convert logical volumes to thinpools
sudo lvconvert -y --zero n -c 512K --thinpool ${vgname}/${lvname} --poolmetadata ${vgname}/${lvname}meta
Create thinpool monitoring policy
mkdir -p /etc/lvm/profile/ tee /etc/lvm/profile/${vgname}-${lvname}.profile << EOF activation { thin_pool_autoextend_threshold=80 thin_pool_autoextend_percent=20 } EOF lvchange --metadataprofile ${vgname}-${lvname} ${vgname}/${lvname} lvs -o+seg_monitor
Add Storage Options to /etc/docker/daemon.json
Adding “-tpool” to dm.tinpooldev is important on debian systems.
{ "storage-driver": "devicemapper", "storage-opts": [ "dm.thinpooldev=/dev/mapper/docker-thinpool-tpool", "dm.use_deferred_removal=true", "dm.use_deferred_deletion=true", "dm.mountopt=mand" ] }
docker-lvm.txt · Last modified: 2020/04/25 18:47 by baumi