0

I currently try to map a local folder/drive on my Windows Docker container. I try to achieve this with the net use command. For example to map drive C to the letter M:

net use M: \\localhost\c$

If I do so, I get the following error message:

System error 1231 has occurred.

The network location cannot be reached. For information about network troubleshooting, see Windows Help.

Does this have anything to do with the fact, that localhost is treated differently in docker containers?

The background story is, that I want to run some tests (with pytest in Python), which require a valid network drive and a valid UNC network path (like \\server\folder, e.g.: \\localhost\some-folder). For use cases without the windows containers this works like a charm (see also here).

My used image for this container is: mcr.microsoft.com/windows:ltsc2019

What I already tried:

  • subst M: C:\
    Works, but does not have the same effect as with net use (the path does not resolve as a network path).
  • net use M: \\127.0.0.1\c$
    Results also in the following error:
    System error 1231 has occurred.
    
    The network location cannot be reached. For information about network troubleshooting, see Windows Help.
    
  • net use M: \\<Name of the Container (Hostname)>\c$
    Name of the Container (Hostname) taken from docker inspect.
    System error 1231 has occurred.
    
    The network location cannot be reached. For information about network troubleshooting, see Windows Help.
    
  • net use M: \\<IP of the container>\c$
    IPv4 of the container, taken from output of ipconfig or docker inspect.
    System error 1231 has occurred.
    
    The network location cannot be reached. For information about network troubleshooting, see Windows Help.
    

Also all other combination with valid paths do not work, e.g.: net use M: \\localhost\c$\existing-folder

Toxiin
  • 11
  • 2

0 Answers0