Docker – Mounting an Azure file share using Cloudstor on a local Docker container

azureazure-storagedockermount

I'm developing a docker image that requires access to shared data in a Azure file share. I want to test this locally before deploying to Azure and I'm not using swarms.

I'm using the Azure CloudStor Docker plugin

I've successfully installed the Cloudstor plugin locally:

docker plugin install --alias cloudstor:azure --grant-all-permissions docker4x/cloudstor:17.06.1-ce-azure1 CLOUD_PLATFORM=AZURE AZURE_STORAGE_ACCOUNT_KEY="..." AZURE_STORAGE_ACCOUNT="..."

And successfully compiled my container using a Docker file:

FROM nvidia/cuda:10.1-base-ubuntu18.04

# Update + Prerequisites
RUN apt-get update \    
    && apt-get -y install build-essential checkinstall \
    && apt-get -y install sudo \
    && apt-get -y install curl \
    && apt-get -y install zip \
    && apt-get -y install unzip \
    && apt-get -y install cifs-utils \    
    && apt-get -y install nfs-common nfs-kernel-server

# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

# SMB ports
EXPOSE 137/udp 138/udp 139 445

RUN mkdir /mnt/myshare

If I run the container without –mount everything works fine.

If I however try this:

docker run -it myImage --mount type=volume,volume-driver=cloudstor:azure,source="myAzureShare",destination="/mnt/myShare" /bin/bash

I get this error:

docker.exe: Error response from daemon: OCI runtime create failed:
container_linux.go:345: starting container process caused "exec:
\"–mount\": executable file not found in $PATH": unknown.

Do I need to install any CloudStor dependencies in the image? Are there any extra parameters I need to add when running the container?

Edit: this fixed the above error. But now it's as though Docker can't find the image when i use the –mount flag:

docker.exe: Error response from daemon: pull access denied for
myImage, repository does not exist or may require 'docker
login': denied: requested access to the resource is denied.

If I don't use –mount the image loads fine

Best Answer

Mounting an Azure file share using Cloudstor on a local Docker container

You can try "Docker Volume Driver for Azure File Storage",it uses SMB as well CIFS protocols for file share. Here you can find source code - https://github.com/Azure/azurefile-dockervolumedriver
CloudStor Docker plugin is well suitable for AWS.

Even by using YAML template you can mount a volume in a container group where all containers in the group can access.
https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files

Related Topic