Docker has a pluggable storage architecture which currently contains 6 drivers.
AUFS - Original docker storage driver. OverlayFS Driver built on top of overlayfs. Btrfs Driver built on top of brtfs. Device Mapper Driver built on top of the device mapper. ZFS Driver built on top of the ZFS file system. VFS A VFS-layer driver that isn't considered suitable for production.
If you have docker installed you can run ‘docker info’ to see which driver you are using:
docker info | grep "Storage Driver:"
Storage Driver: devicemapper
Picking the right driver isn’t straightforward due to how fast docker and the storage drivers are evolving. The docker documentation has some excellent suggestions and you can’t go wrong using the most widely used drivers. I have hit a couple of bugs with the overlayfs driver and I have never bothered with the devicemapper driver with loopback files (vs. the device mapper driver w/ direct LVM) because of Jason’s post.
My biggest storage lesson learned (i.e., I do this because I hit bugs) from the past year is to give docker a chunk of dedicated storage. This space can reside in your root volume group, a dedicated volume group or in a partition. To use a dedicated volume group you can add “VG=VOLUME_GROUP” to /etc/sysconfig/docker-storage-setup:
To use a dedicate disk you can add “DEV=BLOCK_DEVICE” to /etc/sysconfig/docker-storage-setup:
If either of these variables are set docker-storage-setup will create an LVM thin pool which docker will use to layer images. This layering is the foundation that docker containers are built on top of.
If you change VG or DEVS and docker is operational you will need to backup up your images, clean up /var/lib/docker and then run docker-storage-setup to apply the changes. The following shows what happens if docker-storage-setup is run w/o any options set:
Rounding up size to full physical extent 412.00 MiB Logical volume "docker-poolmeta" created. Logical volume "docker-pool" created. THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.) Converted docker/docker-pool to thin pool. Logical volume docker/docker-pool changed.
This create the data and metadata volumes in the root volume group and updates the docker configuration. If anyone is using the brtfs or zfs storage drivers shoot me a note to let me know what your experience has been.