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

5 min read
March 27, 2023
July 8, 2025
Last updated:
July 11, 2025
Neil Cresswell
Neil Cresswell
,
Portainer CEO
Follow on LinkedIn
Table of Contents

Share this post
This is some text inside of a div block.

Key takeaways

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

Infrastructure Moves Fast. Stay Ahead.

Subscribe to our monthly newsletter

Conclusion

Neil Cresswell
Portainer CEO
Follow on LinkedIn

Neil Cresswell is the co-founder and CEO of Portainer, a popular platform that simplifies container management for Docker, Kubernetes, and edge environments. A veteran of over 25 years in IT, he began his career with 12 years at IBM before leading VMware consulting at ViFX across Asia-Pacific and serving as CEO for cloud service providers. Frustrated by the lack of usable tooling for “containers as a service,” he created Portainer to make container technology accessible to everyone. Under his leadership, Portainer has grown from an open-source UI into an enterprise-ready platform used globally.

Tip  / Call out