Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Docker for windows to volume-mount a windows drive into a Linux container

I'm using Docker for windows and I want to find where the volumes are created by Docker, in a Linux container?

Has anyone been able to perform the volume mounting that I am trying to achieve?

like image 786
Yousra ADDALI Avatar asked Mar 29 '20 15:03

Yousra ADDALI


People also ask

How do I map a Windows folder to a Docker container?

In order to share Windows folders with Docker containers, you first need to configure the "Shared Drives" option in Docker settings. Once the Shared Drives option is configured, you can mount any folder on shared drives with the "-v" (volume) flag.

Can I run a Windows container on Linux Docker?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.

Can I Dockerize a Windows application?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.


1 Answers

If you're just trying to mount a windows path to a Linux based container, here's an example using the basic docker run command:

docker run -d --name qbittorrent -v "/f/Fetched Media/Unsorted":/downloads -v "/f/Fetched Media/Blackhole":/blackhole linuxserver/qbittorrent

This example shares the f:\Fetched Media\Unsorted and f:\Fetched Media\Blackhole folders on the Windows host to the container, and within the Linux container you'd see the files from those Windows folders in the respective Linux paths shown to the right of the colon(s).

i.e. the f:\Fetched Media\Unsorted folder will be in the /downloads folder in the Linux container.

*First though, make sure you've shared those Windows folders within the Docker Desktop settings area in the GUI.

Update for WSL(2): You don't need to specifically share the Windows folder paths; that's only needed when not using WSL.

like image 121
J. Scott Elblein Avatar answered Sep 21 '22 02:09

J. Scott Elblein