Map network share into windows docker container (WCOW)

We have old Windows Server 2022 servers, where Docker Engine service run from Local system account, servers have smb share mapped to M: and we could map this share into containers, using forward and backslashes:

$ docker run --rm -v M:/.c:C:/.c mcr.microsoft.com/windows/server:ltsc2022 cmd /c dir C:\.c
<dir output>
$ docker run --rm -v M:\.c:C:\.c mcr.microsoft.com/windows/server:ltsc2022 cmd /c dir C:\.c
<dir output>

But I cannot do the same on Server 2025, when Docker Engine service run from Local system account (neither 2022 nor 2025 based images are working):

$ docker run --rm -v M:/.c:C:/.c mcr.microsoft.com/windows/server:ltsc2022 cmd /c dir C:\.c
docker: Error response from daemon: invalid volume specification: 'M:/.c:C:/.c': invalid mount config for type "bind": bind source path does not exist: m:\.c
$ docker run --rm -v M:/.c:C:/.c mcr.microsoft.com/windows/server:ltsc2025 cmd /c dir C:\.c
docker: Error response from daemon: invalid volume specification: 'M:/.c:C:/.c': invalid mount config for type "bind": bind source path does not exist: m:\.c

When I stop docker service and run dockerd manually, so it definitely would have access to M:, error is changing

$ docker run --rm -v M:/.c:C:/.c mcr.microsoft.com/windows/server:ltsc2025 cmd /c dir C:\.c
docker: Error response from daemon: hcs::CreateComputeSystem 6b7bed1c8264b9c4393af80b67f5d04f207644c3e3d9bdfbb3f909cc8b724087: The system cannot find the path specified.

If I start container mapping only local disks into it, I can map network share inside of container, bit it would not be trivial to adapt that approach in all places currently using old system.

Is there a way map smb share into docker container on Server 2025? Question about pure windows containers in process isolation mode, no linux containers, docker desktop, WSL or Hyper-V involved here.

@vrapolinario can you chime in?

If something worked on Windows Server 2022 and doesn’t work in Windows Server 2025, that looks like a regression, and I’d recommend opening a support ticket or at least an issue on the Windows Containers Github repo: GitHub - microsoft/Windows-Containers: Welcome to our Windows Containers GitHub community! Ask questions, report bugs, and suggest features — let's work together. · GitHub

With that said, the documentation recommends mapping the SMB drives with a credential: Persistent storage in containers | Microsoft Learn
Not sure if that helps or not, but worth trying.

This network share does not have credentials, we enable insecure logons so it would work - also credentials used when share mapped to a letter - that part is working without issues - docker does not see that letter, I’ll create issue on github, thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.