Skip to content

Instantly share code, notes, and snippets.

@alexrashed
Created October 7, 2021 11:48
Show Gist options
  • Save alexrashed/5b4ccc98ec2e2e7cbed01c6108397918 to your computer and use it in GitHub Desktop.
Save alexrashed/5b4ccc98ec2e2e7cbed01c6108397918 to your computer and use it in GitHub Desktop.
Creates a new ZFS volume for docker with ext4
#!/bin/bash
# This is just a writeup to build an ext4 FS on top of ZFS to overcome issues with the Docker ZFS storage driver.
# DO NOT EXECUTE THIS SCRIPT IF YOU DO NOT KNOW WHAT YOU'RE DOING!
sudo zfs create -V 100G rpool/docker-overlay
sudo mkfs.ext4 /dev/zvol/rpool/docker-overlay
sudo mount /dev/zvol/rpool/docker-overlay /var/lib/docker-overlay
docker system prune -af
sudo su
cat > /etc/docker/daemon.json << EOF
{
"data-root": "/var/lib/docker-overlay",
"storage-driver": "overlay2"
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment