Jordi
Jordi

Reputation: 51

Haven't been able to bind mount a network drive on Docker for Windows

I'm trying to bind mount a network drive from my host (Windows 10) to a local folder in a container but, regrettably, I haven't been able to achieve it.

In Linux I've had no issues whatsoever.

Any help would be greatly appreciated :)

docker run -v G:/:mnt/shared ubuntu /bin/bash

Upvotes: 4

Views: 5711

Answers (2)

Jordi
Jordi

Reputation: 51

I managed to do it in a different way.

Here is the answer: Docker add network drive as volume on windows

Upvotes: 1

Abdullah Khawer
Abdullah Khawer

Reputation: 5738

For local drive, use the following command:

docker run -v c:/your-directory/:/mnt/shared ubuntu /bin/bash

For network drive, you need to create a Docker volume pointing to that network drive.

The command would be as follows:

docker volume create --driver local --opt type=cifs --opt device=//networkdrive-ip/Folder --opt o=user=yourusername,domain=yourdomain,password=yourpassword mydockervolume
docker run -v mydockervolume:/data alpine ls /data

Reference is here: How to Add Network Drive as Volume in Docker on Windows

Upvotes: 2

Related Questions