I use ZFS as a storage driver for docker engine running on my machine. Today after my machine rebooted from a crash, yes Linux system crashes too, I notice that all my docker images and containers disappeared.
First thing came to my mind was “did I accidentally destroy docker zfs data set last night?”
It’s still there. At that point I suspected that Docker might no longer use ZFS as its data storage.
The output information from docker info command confirmed my suspicion. But how do we change the storage back to ZFS instead of devicemapper? According to ZFS storage in practice the only prerequisite to have ZFS as the data storage is having /var/lib/docker
as a ZFS dataset.
I was under the impression that tank/docker
was mounted to /var/lib/docker
. Actually /var/lib/docker
directory lived on my local LVM file system (hence devicemapper was the storage driver).
To fix this, I stopped docker service, cleared out /var/lib/docker
, and re-mounted the tank/docker
dataset.
Let’s see if it’s working again.
Everything seemed to back to normal. I’m still not sure why tank/docker
wasn’t mounted on boot, but I’ll leave it for another day. As for now, I’m quite happy.