ZFS storage on Docker
Asked Answered
E

1

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?

Equally answered 24/8, 2016 at 3:53 Comment(3)
aufs is the fallback when anything fails. What does the docker daemon log at startup?Unhandy
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 logsEqually
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=infoUnhandy
R
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
Rictus answered 14/11, 2016 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.