It appears Docker now works fine on Incus containers with zfs storage

Before now, when installing Docker in an Incus instance with zfs storage, it is near unusable out of the box and you would need to work around it or switch entirely to another storage driver.

I noticed today while using Incus that Docker now works fine with zfs out of the box. The storage driver section of docker info shows the following.

 Storage Driver: overlay2
  Backing Filesystem: zfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: true

I have tried searching online to confirm if that is indeed the case but haven’t found anything substantial. However, I noticed that zfs is now a supported storage driver for Docker ZFS storage driver | Docker Docs.

Can anybody else confirm if that is indeed the case?

Update: I came across this as well Update [2025] on Docker inside LXD container with ZFS storage with GPU passthrough - LXD - Ubuntu Community Hub.

After further tests, it appears this is not yet the case. While the intial launch of the containers are quick, subsequent ones are sluggish.

A false excitement it seems, sadly :frowning: .

Docker has worked extremely well in LXC with Incus for a while now. Here is how I do it.

I fell in similar situation once again and I have finally figured this out.

1 Configure ZFS Pool Delegate

incus storage volume set <storage name> container/<container name> zfs.delegate=true

2 Install zfs utls package in the container

sudo apt install zfsutils-linux

3 Set zfs as storage driver in docker daemon settings.

Edit /etc/docker/daemon.json and set the following.

{
  "storage-driver": "zfs"
}

Finally, restart the docker services or simply restart the container and everything should work just fine.

To verify it is working, docker info should have something similar to this under Storage Driver.

 Storage Driver: zfs
  Zpool: default
  Zpool Health: ONLINE
  Parent Dataset: default/containers/ubuntu
  Space Used By Parent: 417035264
  Space Available: 102805632000
  Parent Quota: no
  Compression: on

Note that, as per the Docker ZFS docs you linked:

The ZFS on Linux (ZoL) port is healthy and maturing. However, at this point in time it is not recommended to use the zfs Docker storage driver for production use unless you have substantial experience with ZFS on Linux.

How’s your been experience with it?

Edit: I’m wary of using it as it still has a number of unresolved bugs around snapshot creation/deletion and the impossibility to clean up old layers lingering after many years, and with 2.2 introducing overlayfs support I suspect there is even less motivation to improve it now.

Yeah, I mainly use it on my development environments and it works fine.
Nonetheless, using a separate volume for docker is the more reliable approach.

1 Like