Skip to content
Securely manage Docker, Swarm, Kubernetes and Podman clusters in the cloud, on-premise, and in the data center.
Secure app deployment and device management for your Industrial IoT, IoT and Edge devices.
Let Portainer's Managed Platform Services accelerate your containerization journey.
Manage all your Docker, Swarm, Kubernetes and Podman clusters from a single secure interface.
Portainer empowers Platform Engineering teams to deliver efficient, user-centric services.
Empower your business by adopting containerization the easy way with Portainer.
Deploy to and manage your fleet of remote devices centrally and securely.
Onboard, manage and deploy workloads across hundreds of devices securely with Portainer.
Deployment scenarios
Partner Solutions
Neil Cresswell, CEOMarch 27, 20231 min read

How To: Mount a CIFS share to a container in Docker Desktop

So I had someone ask me today, "How do i mount a remote CIFS share to a container running on Docker Desktop on Windows"... and to be honest, i had no idea... so i tested it..

First problem, Docker Desktop uses an alpine based WSL2 image, and this image is missing the cifs-utils package.. this needs to be installed

Open the Windows command prompt, and type "wsl --distribution docker-desktop"

You will then get a console into the WSL2 instance.

Then type "apk add cifs-utils" and wait for it to install

Now switch back to Docker Desktop, and using the Portainer Extension, you can define a volume that maps to the CIFS share as follows:

Note: substitute the IP address of your CIFS target (dont use dns name as that just adds complexity), and add in a username and password that has access to the CIFS share.

See the volume is created. Dont worry about the mount point location, thats just where Docker mounts the CIFS share into.

Now you can add this volume to a container..

Then click "deploy container"

Once the container is deployed, open a console into the container to validate the share..

Compare against the share itself..

 

Success.. works perfectly.

So this is how you attach a CIFS share to a container inside Docker Desktop for Windows (using Portainer Extension).

Neil

 

 

 

avatar

Neil Cresswell, CEO

Neil brings more than twenty years’ experience in advanced technology including virtualization, storage and containerization.

COMMENTS

Related articles