I'm trying to access a remotely shared folder from within a docker container on Docker for Windows.
While inside the container running dir \\target\share
produces "The network path was not found.". The target can be pinged from inside the container and from the host system the share is accessible.
The image used is microsoft/dotnet-framework:4.7.2-sdk
and I'm running it with just the -it
option for testing.
What am I missing to get this to work?
The SMB protocol works with hosts in the same LAN. A docker container, by default, has a virtual network interface behind a NAT, so the container is no longer in the same LAN. This is why you can ping the target, but you can't access the shared folder.
The easier solution is to add the option --network host
to the docker run
command.
In this way the container has access to the same network interfaces as the host and no virtual interface is created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With