Docker vs. Shared windows folders Docker vs. Shared windows folders docker docker

Docker vs. Shared windows folders


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.


You can use docker volumes to mount a folder/network share in the container

Create docker volume on the host:

$ docker volume create --driver local \    --opt type=nfs \    --opt o=addr=192.168.1.1,rw \    --opt device=:/path/to/dir \    foo

Mount the volume on container:

$ docker run -d \  --name devtest \  --mount source=foo,target=/app \  nginx:latest

More examples here