7

I would like to try out ZFS on Ubuntu(16.04) docker container. Followed the following https://docs.docker.com/engine/userguide/storagedriver/zfs-driver/

> lsmod | grep zfs
zfs                  2813952  5
zunicode              331776  1 zfs
zcommon                57344  1 zfs
znvpair                90112  2 zfs,zcommon
spl                   102400  3 zfs,zcommon,znvpair
zavl                   16384  1 zfs

Listing the ZFS mounts

>sudo zfs list
NAME                  USED  AVAIL  REFER  MOUNTPOINT
zpool-docker          261K   976M  53.5K  /zpool-docker
zpool-docker/docker   120K   976M   120K  /var/lib/docker

After starting docker

> sudo docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.12.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: zfs
 Dirs: 0
 ...

Wonder why I still get **Storage Driver: aufs & Root Dir: /var/lib/docker/aufs" in place of zfs?

Also how can I map "/zpool-docker" into the Ubuntu container image?

Vic
  • 1,985
  • 1
  • 19
  • 30
  • `aufs` is the fallback when anything fails. What does the [docker daemon log](http://stackoverflow.com/a/30970134) at startup? – Matt Aug 24 '16 at 04:56
  • Can find docker daemon logs @ /var/log/upstart/docker.log. How to enable daemon logging. FYI, I start docker daemon "sudo service docker start". Not sure of I need to pass some flag for getting logs – Vic Aug 24 '16 at 05:08
  • I thought it would have been logging already... `/etc/default/docker` and `/etc/init/docker.conf` should detail the docker daemon options. You could temporarily add a `-D` for debug or `--log-level=info` – Matt Aug 24 '16 at 08:22

1 Answers1

9

Assuming you have:

  • a ZFS pool (let's call it data)
  • a ZFS dataset mounted on /var/lib/docker (created with a command along the line of: zfs create -o mountpoint=/var/lib/docker data/docker)

Then:

Stop your docker daemon (eg. systemctl stop docker.service)

Create a file /etc/docker/daemon.json or amend it to contain a line with "storage-driver" set to zfs:

{
...
        "storage-driver": "zfs"
...
}

Restart your docker daemon.

docker info should now reveal:

Storage Driver: zfs
Zpool: data
Zpool Health: ONLINE
Parent Dataset: data/docker
Laurent Gosselin
  • 2,051
  • 1
  • 11
  • 10