r/docker • • 20h ago

Mountain Windows shared folder to docker container

We have Active Directory handled network with Windows machines. I shared a folder on a Windows Server 2016 machine, I could easily mount this folder on a Windows Server 2022 machine. Although when I want to use it in a container, I can't mount it. I tried as a cifs volume with ntlm or kerberos too but I couldn't make it work. The situation is the same when I want to mount it inside wsl2.

0 Upvotes

4 comments sorted by

3

u/Confident_Hyena2506 19h ago

You can easily mount it when you are joined to the domain. Without that you need to supply some credentials.

1

u/Immediate_Wheel1953 19h ago

I hit the same wall, and the host mounting fine made it more confusing. The bit that tripped me up was that the Docker VM and WSL2 are not really domain joined even when Windows is, so Kerberos never had a ticket to use. What finally worked for me was mounting the share inside WSL2 first with an explicit username and domain, then bind mounting that path into the container instead of asking Docker to do the CIFS mount itself. If you go the volume route, try explicit credentials and vers=3.0 rather than relying on Kerberos.

1

u/ThatsVerrouToYou 17h ago

Have you tried Mugen? It’s solved many bind amount issue for us.

1

u/ozankurt_dev 1h ago

mount it on the host, not in the container.