Skip to content

Instantly share code, notes, and snippets.

@AnatomicJC
Last active February 15, 2023 11:52
Embed
What would you like to do?
ZFS and Docker

Create a dedicated ZFS docker pool with deduplication disabled in case of dedup enabled on your system:

zfs create -o mountpoint=/var/lib/docker -o dedup=off rpool/docker

Sometimes, you don't want ZFS for docker storage. ZFS can be sadly quite painful with Docker in Docker and similar scenarios. It might be best to avoid the problem by creating a volume in your ZFS pool, formatting that volume to ext4, and having docker use "overlay2" on top of that, instead of "zfs".

zfs create -s -V 30G rpool/docker
mkfs.ext4 /dev/zvol/rpool/docker
tune2fs -o journal_data_writeback /dev/zvol/rpool/docker
mount /dev/zvol/rpool/docker /var/lib/docker

Add the mount to /etc/fstab:

$ cat /etc/fstab
/dev/zvol/rpool/docker /var/lib/docker	ext4 noatime,data=writeback,barrier=0,nobh,errors=remount-ro 0 1

Ref:

@mraaroncruz
Copy link

🙏

@AnatomicJC
Copy link
Author

You're welcome man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment