RHEL8 migrate from overlay2 to zfs storage driver

I have been using docker for quite some time but have never needed to migrate my storage driver before.

It seems like there are a lot of underlying settings that rely specifically on the storage driver and I can’t just simply change the storage driver setting and have everything working.

I have created several different zpools and attempted migration from overlay2 storage driver to zfs but it fails everytime. I have copied a lot of files over but once I start docker nothing picks up and it fails trying to start the containers with an issue like this:

ERROR: for traefik Cannot start service traefik: error creating zfs mount: mount CASE/zfsdockerstor/55bf8e31ea7cb00795b9a4e5997e830b3f642f016990af91412bc540963b482f:/var/lib/docker/zfs/graph/55bf8e31ea7cb00795b9a4e5997e830b3f642f016990af91412bc540963b482f: no such file or directory

Does anyone have ideas on how I can get this migrated properly?

Okay - so it looks like moving everything from /var/lib/docker/overlay2 → /var/lib/docker/zfs worked.

I had to change every config.v2.json to use “zfs” driver & I had to delete everything within /var/lib/docker/images. Then I docker compose all of my compose files and it just “worked”. Small edits needed but I’m very happy!

You should never manually edit anything under the Docker Data root. Changing storage driver is basically like moving everything from one machine to another. You save the volumes, config files, compose files, move it to another system, create new volumes, import the data, start the project again which downloads images. Optionally you can save images using docker image save and load them using docker image load on the new machine.

Even if you think your containers work now, you can experience issues later or even data loss if you missed something. Hopefully it will not happen.

I have a full backup of the overlay2 configured partition so shouldn’t be an issue to revert if required. It does seem that some data didn’t pull over but it is not essential data so I’m not worried.

The only edit to files I made was the config json files. Otherwise seems to be good on my end…it autocreated all of the necessary zfs zvols for every container.