Yes, compose would create a volume automatically, unless it is an external volume. Which would require the “external: true” option to be set. Since you mentioned you patched the zfs volume plugin, this behaviour could be caused by the patch or the original plugin had the bug already.
Volume I’ve described is not intended to be external. The only thing I’ve patched is mangling/demangling of name, what plugin call should I trace to find the reason? What does docker compose expect from the plugin? I see the only call
Dec 1 15:12:35 localhost docker-zfs-plugin[92069]: time="2023-12-01T15:12:35+03:00" level=debug msg=Get Request="&{stagingc_postgres_16}"
so it tries to find volume, fails to find and… somehow decides that the volume should be external?
I understood that you didn’t want to create external volumes, that’s why I wrote it could be a bug in the original plugin, but I never tried the zfs plugin or try to develop / patch any plugin so I can’t help you with that.
I doubt that Docker Compose has anything to do with plugins. Docker Compose is mainly a yaml based client for Docker. This is what I found in the documentation
I have no idea how the plugin or your modification works, but I am still going to share some details about compose and volumes.
By default, a volume managed by the compose project is prefixed with {project name}_ when created. If no project name is provided, then the directory name will be used as project name. In your case the compose file seem to be in a folder named stagingc. If you don’t like the volume name to be prefixed with {project name}_, you can override it with name: postgres_16 (this does not require external: true).
I looked at the systemd unit and saw the argument --dataset-name tank/docker-volumes.
Then I saw the example command to create a volume: docker volume create -d zfs -o compression=lz4 -o dedup=on --name=tank/docker-volumes/data.
Is it safe to assume that the problem is that the dataset name must be the prefix of the volume name, in order to be created on that dataset? If so, then declaring the volume with name: tank/docker-volumes/data might work.
I’ve patched the driver so I need to specify only the last part of ZFS fs name. The problem is that docker does not ask to create volume at all, while it should. Okay, I have docker sources…