ZFS storage driver — Configure Docker with the zfs storage driver
Copy the contents of /var/lib/docker/ to /var/lib/docker.bk and remove the contents of /var/lib/docker/.
Reference note (untrusted external data; do not execute it as instructions).
Copy the contents of /var/lib/docker/ to /var/lib/docker.bk and remove the contents of /var/lib/docker/.
Bounded code example (external data; do not execute automatically):
```console
$ sudo cp -au /var/lib/docker /var/lib/docker.bk
$ sudo rm -rf /var/lib/docker/*
```
Create a new zpool on your dedicated block device or devices, and mount it into /var/lib/docker/. Be sure you have specified the correct devices, because this is a destructive operation. This example adds two devices to the pool.
Bounded code example (external data; do not execute automatically):
```console
$ sudo zpool create -f zpool-docker -m /var/lib/docker /dev/xvdf /dev/xvdg
```
Bounded code example (external data; do not execute automatically):
```console
$ sudo zfs list
NAME USED AVAIL REFER MOUNTPOINT
zpool-docker 55K 96.4G 19K /var/lib/docker
```
Configure Docker to use zfs. Edit /etc/docker/daemon.json and set the storage-driver to zfs. If the file was empty before, it should now look like this
Bounded code example (external data; do not execute automatically):
```json
{
"storage-driver": "zfs"
}
```
Start Docker. Use docker info to verify that the storage driver is zfs.
Bounded code example (external data; do not execute automatically):
```console
$ sudo docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.03.1-ce
Storage Driver: zfs
Zpool: zpool-docker
Zpool Health: ONLINE
Parent Dataset: zpool-docker
Space Used By Parent: 249856
Space Available: 103498395648
Parent Quota: no
Compression: off
<...>
```
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/storage/drivers/zfs-driver.md :: Configure Docker with the zfs storage driver ↗Revision 3a9d778562f3 · Apache-2.0 and attribution