Using ZFS For The Docker COW Storage Layer(s) In Ubuntu 17.04

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Switching Docker AUFS to Docker ZFS

Below I will show you, how to switch from the default Docker AUFS storage driver to the ZFS storage driver on Ubuntu 17.04.

First lets make sure that ZFS support is load in the kernel.

Next, lets install the ZFS utilities, this is needed to be able to initialize a ZFS Zpool.

Preparing a ZFS file system for Docker use

Since I don’t have any spare drives to play with, I will be using files to create the ZFS Zpool, feel free to replace that with /dev/sd* or whatever you like to use.
I will be using the /zfsdevs to store the Zpool files.

Next, I am creating the files used to store/construct the Zpool file system.

Finally, created the Zpool, I named my pool zdocker.

Now lets change Docker to use the ZFS driver

First, lets stop the Docker daemon

Modify the DOCKER_OPTS in /etc/default/docker with the below ZFS options.

Move the old images aside, by coping the directory.

Create the new zfs file system, this will be used by Docker.

Instruct docker to use the ZFS driver

Finally, start the docker daemon(now with ZFS support).

To make sure Docker is using the ZFS driver, run the below

To make the ZFS mounts permanent, make sure to check the /etc/default/zfs options

Docker using ZFS in action

First lets pull some images, like so.

You can check ZFS in action, by doing the below, about six snap’s(layers) are created for this image.

Next, lets start some ubuntu containers, to see the full ZFS COW in action.
This below will start three Ubuntu containers.

Finally, You can see the ZFS snapshots below from the three new images created, once removed by docker rm they will go away.

To clean this containers, you can just run the below, then verify the ZFS snap’s

Whats your experience using Docker and alternative file systems, please let me know in the comments below?

You might also like, Tips creating private docker registry with self signed certificate

Leave a Reply

Notify of