Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZFS storage on Docker

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?

like image 688
Vic Avatar asked Aug 24 '16 03:08

Vic


People also ask

How to setup Docker on Proxmox VE using ZFS?

Setup Docker on Proxmox VE Using ZFS Storage. If you install Docker CE as normal, and Proxmox VE was setup with the installation on a ZFS rpool, then the system will fail to boot if you make a container using default settings. After installing Docker, we will see that it automatically selects the ZFS storage driver: # docker info | grep Storage.

Can I change the Docker container storage directory to ZFS?

Another concern is that the if you are installing on a boot device such as a SATA DOM you may want to change the Docker container storage directory to a zfs pool using the same procedure. What we need to do now is stop Docker and change the configuration to mount to a different location.

What is ZFS storage driver?

Use the ZFS storage driver. ZFS is a next generation filesystem that supports many advanced storage technologies such as volume management, snapshots, checksumming, compression and deduplication, replication and more.

How do I change the storage driver for my Docker container?

To see what storage driver Docker is currently using, use docker info and look for the Storage Driver line: To change the storage driver, see the specific instructions for the new storage driver. Some drivers require additional configuration, including configuration to physical or logical disks on the Docker host.


1 Answers

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
like image 58
Laurent Gosselin Avatar answered Oct 22 '22 14:10

Laurent Gosselin