Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2827

How to automatically mount a removable USB device in a Docker Desktop Linux container

$
0
0

Problem: I want to run a Linux container via Docker Desktop, and have a removable device (e.g. USB stick) automatically mount within the container, when it's inserted.

Up until now, I've been using WSL2 to run Ubuntu. This allows me to mount a USB drive locally with the following command

# sudo mount -t drvfs d: /mnt/d

I'm issuing this command via a Python web application. I now want to Dockerise my application, and it has to run in Docker Desktop. Some initial testing running a Linux container in WSL2 has not been successful:

# mkdir /mnt/d# mount -t drvfs d: /mnt/dmount: /mnt/d: unknown filesystem type 'drvfs'.       dmesg(1) may have more information after failed mount system call.

So filesystem type 'drvfs' may be something specific to WSL2, allowing you to mount a Windows drive. How do I get this to work in a standard Linux docker container (via Docker Desktop on Windows)? What's the name of the block device I need to mount? Note that since this is a removable device, it won't be plugged in when I start the container.


Viewing all articles
Browse latest Browse all 2827


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>