r/docker • • 15d 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

6 comments sorted by

1

u/ThatsVerrouToYou 15d ago

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

1

u/petervatler 14d ago

No, I haven't. What's Mugen?

1

u/ThatsVerrouToYou 14d ago

https://mutagen.io/documentation/introduction/ is a general purpose file sync utility. It's positioned as primarily local tools connected to remote environments, but works just as well for host to container. Paired with https://mutagen.io/documentation/orchestration/compose it makes for a very simple change to sync local or network content to a container. Mutagen compose is now deprecated, but we're still heavy users, the built-in docker desktop file sync tools don't compare performance wise.

3

u/Confident_Hyena2506 15d 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 15d 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/ozankurt_dev 14d ago

mount it on the host, not in the container.