Accessing Bluetooth dongle from inside Docker?

前端 未结 4 805
逝去的感伤
逝去的感伤 2021-02-08 02:29

Is it possible to use a bluetooth (BLE in my case) dongle inside of a docker container?

On my host machine:

$ hcitool dev
    Devices:
       hci0   5C:F         


        
4条回答
  •  無奈伤痛
    2021-02-08 02:45

    If you want to run bluez from a docker (and not only expose hci adapter) you need:

    • To start your docker with sudo docker run --privileged -i -t your_image_name /bin/bash
    • Make sure bluez is not running on your host. In my case I add to kill bluez (killall -9 bluetoothd) (and not stopped it properly as it will power down my bluetooth adapter and will not exposed it into the docker)
    • In your docker entrypoint, you will need to start dbus (/etc/init.d/dbus start) and bluez (/usr/libexec/bluetooth/bluetoothd --debug &)

提交回复
热议问题