Proxy Bluetooth on RBP4 to HA Container (with docker compose)

On my RaspberryPi 4 with Raspbian I am running a HA from docker image with docker compose. A lot of stuff, integration and devices are working flawlessly (including ZigBee).

I am trying now to start using Bluetooth, following Bluetooth - Home Assistant.

BlueZ is running on my host machine and /run/dbus:/run/dbus:ro added to the volumes in docker composer file, as below:

version: '3'
    container_name: homeassistant
    image: ""
      - /srv/ha_config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
     - /dev/ttyUSB0:/dev/ttyUSB0
     - /dev/ttyACM0:/dev/ttyACM0
     - /dev/ttyAMA0:/dev/ttyAMA0
docker compose restart

`/run/dbus’ on my host:

But on the docker image the /run/dbus is still empty:

And of course HA Bluetooth integration is complaining:

Test that BT is wokring on my host:

bluez service status

Did anyone manage successfully to proxy Bluetooth to HA docker container on RBP platform?

Thanks for any help!

1 Like

I have the same issue, my setup and errors is the same, and I am able to see the Mi Flora device when scanning with bluetoothctl.

Running bluetoothd -n gives this error:

1 Like

I was searching for the same issue (“Retrying setup: DBus…”) with “docker-compose” and found this thread. I didn’t see anywhere about dbus in docker-compose (not just docker, and I’m still not great with docker things). So this post helped.

I ran docker-compose up -d and it looks like it’s working (but I don’t have any bluetooth devices!).
Is it possibly as simple as not “up -d” to recreate (vs. restarting) for you?
Thanks for your post.

1 Like

That solved it for me

1 Like

Glad it helped!
Docker compose is just a ‘wrapper’ over docker, so you can write down docker configuration in one .yml file, including multiple services (multiple docker images).

“up” command creates and starts the container, “-d” simply detaches docker from the current process (run containers in the background).

A kind question for you - what kind of system do you have (HW/OS - Raspberry Pi 4? Raspbian?)
I understood that in your case adding /run/dbus volume was enough to get rid of startup error for Bluetooth integration in HA?

Well, after multiple restarts (including the whole Pi) it started working also for me.

This command might be also helpful (although I am not sure did it has any influence in my case):

sudo systemctl restart bluetooth.service

Now dbus socket is visible in the container, as expected:

I’m glad yours is working now :slight_smile:
I use a Raspberry Pi 4 with Raspbian.
I know a ‘reasonable’ amount about docker-compose and Docker, but I don’t often have to translate Docker-specific options to docker-compose like this. It’s obvious enough when you know (-v is for volume), but I’m still getting used to that kind of thing without examples.

1 Like