Install Docker

To install Docker run the following commands on your server:

apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install docker-ce -y

Configure ZFS Storage Driver

For Docker to run properly on a ZFS server we need to enable ZFS storage driver for Docker. First run commands:

systemctl stop docker
rm -rf /var/lib/docker
zfs create -o mountpoint=/var/lib/docker rpool/docker
mkdir /etc/systemd/system/docker.service.d

This will put all docker data into a new ZFS volume. Now we need to create the following config file /etc/systemd/system/docker.service.d/storage-driver.conf and add populate it with:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --storage-driver=zfs -H fd://

Finally, reboot docker service by running commands:

systemctl daemon-reload
systemctl start docker
Categories: Blog

3 Comments

Bachelor of Interior Program Telkom University · July 5, 2021 at 3:58 pm

thanks for sharing this useful information

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *