Accessing a bluetooth dongle from inside Docker?

Is it possible to use bluetooth (BLE in my case) key in docker container?

On my main machine:

$ hcitool dev Devices: hci0 5C:F3:70:64:F0:11 

Inside Docker, he finds nothing. I run Docker as:

 sudo docker run --privileged -i -t ubuntu /bin/bash 

I donโ€™t know enough about the bluetooth subsystem in Linux to understand what is different between the host and docker.

The hci0 device hci0 displayed on both systems:

 $ ls -l /sys/class/bluetooth lrwxrwxrwx 1 root root 0 Mar 5 01:23 hci0 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.3/2-2.3:1.0/bluetooth/hci0 

Is anyone trying to use bluetooth inside Docker?

+5
source share
2 answers

Try the following:

sudo docker run --net = host --privileged -i -t ubuntu / bin / bash

+1
source

With the help of the Docker community, I successfully started DBus / Bluetooth Services inside the docker container and scanned Bluetooth devices by adding --cap-add = SYS_ADMIN, --cap-add = NET_ADMIN and --net = host flags / permission

docker run --cap-add=SYS_ADMIN --cap-add=NET_ADMIN --net=host -it debian:jessie

Now just see how to start the bluetooth service using "Do not use the host namespace" (setting --net = host for the private network)

If someone got the key, that would be helpful. Thanks.

-1
source

Source: https://habr.com/ru/post/1214705/


All Articles