With the upcoming release of Docker 1.9, Docker Volumes feature just got a whole lot better. We can now extend Docker with plugins such as volume drivers, which can manage and mount non-trivial volumes.

Last week I wrote a Docker volume driver for the Azure File Service —an offering of Azure cloud that allows you to store files using network file sharing protocol and REST APIs. This service is generally available as of today.

This volume driver uses the SMB protocol support of Azure Files to mount a network share on the Linux host, then makes it available to Docker containers as a volume.

The code and documentation can be found on GitHub.

Some use cases

  • Move containers seamlessly in the cluster: without losing the persistent data, just like what Flocker does.
  • Store configuration and secrets on the cloud: instead of copying the credentials into the container image, you can mount the file share that has the application configuration and secrets as a volume.
  • Share data between containers: I can see this being useful for tasks such as batch processing and various forms of coordination that can be done through files.

In the animated GIF above you can see that a volume is created and mounted to various containers and the contents of the volume is persisted on the cloud.

I already started using this in my personal websites and services, it is already helping a great deal in reducing the amount of configuration and secrets I am managing and hence makes it easy to migrate my containers across machines.

Performance

The performance of Azure File Service is not too bad, compared to Azure standard data disks. It operates better on large files rather than a bunch of small files.

If your VM is one of Standard_DS sizes (high IOPS) and your OS/data disks are on Azure Premium Storage (expensive stuff), of course File Service is a lot slower to compared to that. But for A or D series VMs with data disks attached (HostCache=None) will perform almost the same as the File Service.

Even though it does not have the best performance, Azure Files is still very practical to use if you are hitting the volume occasionally.

If you want to go serious with this volume driver, I encourage you to benchmark this yourself with a tool like fio and reading article on deciding when to use Azure Blobs, Files, or Data Disks.

Try it out!

There is a quick tutorial on the GitHub repo. If you encounter any issues or interested in discussing, please open an issue on the GitHub repo.