How to use a host USB device in a container in Docker Desktop?

Kindly take a note of each and every point I will be sending

  1. I have two docker images one is of mysql headlessev-302-evmysqlcont and other is springboot application where its base image is debian-10.6 name is headlessev-302-projcont

  2. these two images are in two containers but they are in same network

  3. My host system is windows machine

  4. one of my docker container is of debian based
    5 . I have written docker-compose file to run my both containers for building i use docker-compose build and run i use docker-compose up my host system is connected to external vector hardware using usb now how can my docker container can detect that usb ?
    7.use this information if required
    Vector Informatik GmbH
    This is my device instance path USB\VID_1248&PID_1001\5&271999B4&0&1
    This is my hardware id USB\VID_1248&PID_1001&REV_0001

  5. Docker file for mysql application
    FROM mysql:latest
    COPY mysqlinit.sql /docker-entrypoint-initdb.d/
    EXPOSE 3306

  6. docker-compose.yml file
    version: “1.0”
    context: .
    dockerfile: Dockerfile

    • 27997:27997
    • 5005:5005
    • “”


    • evmysqlcont


    - “/dev/bus/usb:/dev/bus/usb” # Mount the entire USB bus


    - “//./USB/VID_1248&PID_1001/5&271999B4&0&1”



context: mysqlContainer
dockerfile: Dockerfile
- 27999:3306

Can anyone help how external hardware connected to windows can be detected in debian docker container ?

When running Docker on Windows, do you use Docker Desktop? That creates a Linux VM in which containers are usually run, so you need to attach the USB device to the VM, too.

1 Like

According official Docker Desktop FAQs, it is not possible to pass through a USB device:

Though, you could try if you get working somehow.

1 Like


Accessing external vector hardware in a Docker container is a bit like connecting your computer to a special tool.
Let’s understand with an example, Imagine you have a cool gadget outside your house, and you want to use it on your computer. To make it work inside a Docker container, you have to set up a sort of digital tunnel, so your computer can talk to the gadget. It’s like creating a secret pathway. In tech terms, you might need to use specific commands or configurations to tell the Docker container how to reach out and grab information from the external hardware. Think of it as helping your computer and the gadget have a smooth conversation, even though they’re in different places. Just like giving your computer the right map to find and use the cool tool outside.

I hope this will help you.


1 Like

Yes I use docker desktop

Yes I need to attach the usb to VM too
or can you recommend any tool like VM Box where i can use docker and usb both

This really helped a lot Thanks for giving the clear idea can you suggest any way like that so that I can communicate with the external hardware any suggestions

Thanks for the reply will try to implement this method But I don’t think it might work
Is it possible to pass through usb from linux host to linux container is that possible ?

Of course, as long as you run docker-ce, and not Desktop Desktop.

Can you send the way how to use that ?

Apologies, my wording was kind of ambiguous with run I mean install and run dock-ce.

You can find the official installation instructions here: