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

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, and a Docker Compose example as well:

docker run -d --name qbittorrent -v '/mnt/f/Fetched Media/Unsorted:/downloads' -v '/mnt/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 their 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.


Update:

This seems to be a popular answer, so I thought I'd also include a Docker Compose version of the above example, for the sake of thoroughness (includes how to set a path as read-write (rw), or read-only (ro)):

qbittorrent:
  image: 'linuxserver/qbittorrent:latest'
  volumes:
    - '/mnt/f/Fetched Media/Unsorted:/downloads:rw'
    - '/mnt/f/Fetched Media/Blackhole:/blackhole:rw'
    - '/mnt/e/Logs/qbittorrent:/config/logs:rw'
    - '/opt/some-local-folder/you-want/read-only:/some-folder-inside-container:ro'

I'm not certain why this was needed, but in the event someone else runs into this problem: I had to put the entire volume declaration in double quotes as follows

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

Otherwise, J. Scott Elblein's answer worked perfectly!