Azure File is a Docker Volume Driver which uses Azure File Storage
to mount file shares on the cloud to Docker containers as volumes. It uses network
file sharing (SMB/CIFS protocols) capabilities of Azure File Storage.
- You can create Docker containers that can migrate from one host to another seamlessly.
- You can share volumes among multiple containers running on different hosts.
Before deploying this plugin, please read articles:
- Deciding when to use Azure Blobs, Azure Files, or Azure Data Disks
- Features Not Supported by the Azure File Service
and be aware of the above limitations and what kind of applications are suitable for storing data on Azure File Service.
In addition of previous limitation, Azure File doesn't support the samba unix extention. Without this extention, the filesystem will not support hard link (used by postgres WAL for example), and other unix flavored features.
Make sure you have a Storage Account on Azure (using Azure CLI or Portal).
Docker managed plugin may be installed with following command:
$ docker plugin install jmaitrehenry/azurefile[:version] \ AZURE_STORAGE_ACCOUNT=xxx \ AZURE_STORAGE_ACCOUNT_KEY=yyy
[:version] component in the above command is known as a Docker tag and its value follows the semantic versioning model. Omitting the version is equivalent to specifying the latest tag -- the most recent, stable version of a plug-in.
Starting from Docker 1.9+ you can create volumes and containers as follows:
$ docker volume create --name my_volume -d jmaitrehenry/azurefile
This will create an Azure File Share named
my_volume (if it does not exist).
You can specify additional volume options to customize the owner, group, and permissions for files and directories.
mount.cifs(8) man page more details on these options.
Mount Options Available:
$ docker volume create -d jmaitrehenry/azurefile \ -o share=sharename \ -o uid=999 \ -o gid=999 \ -o filemode=0600 \ -o dirmode=0755 \ -o nolock=true \ -o remotepath=directory my_volume
Note: On a stack file, the
dirmodemust be pass as a string (between quote).
Use a volume
The following example illustrates using a volume:
$ docker run -i -t -v my_volume:/data busybox
Docker will start a container in which you can use
/data directory to directly read/write from cloud file share location using SMB protocol.
Remove a volume
The following example illustrates removing a volume created:
$ docker volume rm my_volume
If you find a typo, have a problem when trying what you find on this article, please contact me!
Subscribe to Julien Maitrehenry
Get the latest posts delivered right to your inbox