Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker vs. Shared windows folders

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?

like image 721
Dawnkeeper Avatar asked Mar 06 '23 09:03

Dawnkeeper


1 Answers

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.

like image 141
Amedeo Avatar answered Mar 28 '23 05:03

Amedeo