This article explains Docker volume driver plugins for data persistence and highlights third-party options for external storage solutions.
Docker leverages storage drivers to manage images and containers, while volume driver plugins handle data persistence. Unlike storage drivers, volumes need to be explicitly created and are managed by these dedicated plugins.
The default volume driver plugin, “local,” creates volumes on the Docker host and stores data at /var/lib/docker/volumes.
Several third-party volume driver plugins further expand Docker’s storage capabilities by enabling volume creation on external storage solutions. Popular plugins include:
Azure File Storage
Convoy
DigitalOcean Block Storage
Blocker
Google Compute Persistent Disks
ClusterFS
NetApp
RexRay
Portworx
VMware vSphere storage
Certain volume drivers support multiple storage providers. For instance, the RexRay storage driver can provision storage on various platforms such as AWS EBS, S3, EMC storage arrays like Isilon and ScaleIO, Google Persistent Disk, and OpenStack Cinder.
When running a Docker container, you can specify a volume driver—such as RexRay for AWS EBS—to provision a cloud-based volume. This approach ensures that your data remains safe even after the container exits.Below is an example command that demonstrates how to run a Docker container with a specified volume driver:
Copy
Ask AI
docker run -it \ --name mysql \ --volume-driver rexray/ebs \ --mount src=ebs-vol,target=/var/lib/mysql \ mysql
This command creates a container named “mysql” and attaches a volume provisioned from Amazon EBS, ensuring persistent data storage in the cloud.While this article focuses on Docker volume driver plugins, remember that Kubernetes also offers robust solutions for managing persistent storage through its volume mechanisms. For more details on persistent storage in Kubernetes, refer to Kubernetes Basics.