ZFS delegate - help needed to understand

Hello, there is a very brief guidance for delegating ZFS:

incus create images:ubuntu/22.04 docker
incus storage volume set default container/docker zfs.delegate=true
incus start docker

But my use case is that I have one ZFS pool only and I want to delegate rpool/docker to the docker container mounted as /var/lib/docker - how to do it?

You can’t, Incus only sets up the delegation on the volumes that it controls.

With the above command, you’ve made it so that the container/docker dataset in whatever pool is used by the docker instance is now delegated to it. Running zfs list inside of the container should show it as such.

If you want to attach another volume to the instance and have that delegated too, then you’ll need to create a custom storage volume with incus storage volume create, set zfs.delegate=true on that too and then attach that volume to your container, it will then show up in its zfs list.

1 Like

OK, still trying to understand:

$ zfs create zfszero/DOCKER
$ incus storage create docker zfs source=zfszero/DOCKER                                                                                                                                     
Storage pool docker created
$ incus storage volume create docker docker
Storage volume docker created
$ incus storage volume set default docker zfs.delegate=true                          
Error: Storage pool not found
$ incus storage list
| docker | zfs    | zfszero/DOCKER |             | 1       | CREATED |

What am I doing wrong?

You created a new storage pool named docker in which you then created a new volume also called docker but then ask Incus to modify the volume named docker in the pool named default, that naturally fails with an error.

I guess you meant to run:

incus storage volume set docker docker zfs.delegate=true
1 Like

OK, syntax is really getting multi-layered and complex, now I can understand. Thank you for help, I hope it will also help other people discovering delegation in Incus!