An easy way to exchange data is Azure Files. The corresponding FileShare can simply be integrated as a network drive in Windows or as a CIFS mount in Linux. However, if a file share is also to be integrated in a Docker container, there are many restrictions. The recommendation, however, is also to integrate a file share via a volume from Docker or Kubernetes and not via CIFS.

Mount Azure Files on Windows

There are detailed instructions and PowerShell scripts to mount Azure Files as Network-Drive in Windows:

Mount Azure Files on Linux

I don’t want to write much about using Azure Files with Linux either, because there are the following instructions from Microsoft:

Please keep in mind, that the cifs-utils package needs to be installed and that Azure Files may need encryted communication.

Mount Azure Files in Linux Docker Image on Linux Host

This works, just use the command from the manual:

mount --verbose -t cifs //<STORAGEACCOUNT><SHARE> /mnt/azfiles -o vers=3.0,username=<STORAGEADMIN>,password=KFcElw9...mnRQ==,dir_mode=0777,file_mode=0777,serverino

Of course, the cifs-utils package must also be installed in the container, otherwise you will get the error message:

mount: /mnt/azfiles: permission denied

The next error will be:

Unable to apply new capability set.

because more privileges are required for mounting within a container, the container must be started with –privileged:

sudo docker run -it --privileged ubuntu /bin/bash

accordingly. Mounting then works.

If you try to mount already in the docker file, the same error message Unable to apply new capability set. will appear.

If you try to mount in the running container and then use docker commit to create a new image from it, the mount point is missing after starting the new image. Of course, this image must also be started with –privileged.

Mount Azure Files in Linux Docker Image on Windows Host

This does not work. You will have the same steps/problems like on the Linux Docker Host, but afterwards get the error message:

mount error(11): Resource temporarily unavailable

The problem seems to be the occupied 445 port, since Docker for Windows also uses SMB on 445 to communicate with the Windows host. A workaround is currently unknown to me.