Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

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
like image 459
Jordi Avatar asked Sep 17 '25 04:09

Jordi


1 Answers

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

like image 112
Abdullah Khawer Avatar answered Sep 19 '25 05:09

Abdullah Khawer