Fix Bluetoothctl No Default Controller Available Docker [Solved]

Running bluetoothctl inside a Docker container often results in the frustrating “No default controller available” error. This happens because Docker containers are isolated from the host’s hardware and the D-Bus system bus by default.

Immediate Fix

To resolve this issue, you must grant the container access to the host’s Bluetooth stack and the D-Bus communication system. Use the following command to start your container correctly:

docker run -it --net=host --privileged -v /var/run/dbus:/var/run/dbus ubuntu bluetoothctl

If you prefer a more granular approach than --privileged, use this configuration:

Flag / Volume Purpose
--net=host Allows the container to share the host’s network namespace.
-v /var/run/dbus:/var/run/dbus Maps the D-Bus socket so the container can talk to the Bluetooth daemon.
--cap-add=NET_ADMIN Grants permission to configure network interfaces (required for Bluetooth).

Technical Explanation

The bluetoothctl utility does not talk directly to the Bluetooth hardware. Instead, it communicates with the bluetoothd daemon via D-Bus, which is a message bus system used in Linux for inter-process communication.

Inside a standard Docker container, the environment is isolated. The container has its own network stack and cannot see the host’s system bus. Without mapping /var/run/dbus, the utility cannot find the daemon, leading to the “No default controller” message.

Furthermore, Bluetooth operations require specific kernel capabilities. The NET_ADMIN capability is necessary for the container to modify Bluetooth states and perform pairing operations.

Diagram showing Docker container connecting to host Bluetooth controller via DBus.

Alternative Methods

Using Docker Compose

For persistent setups, it is better to define these requirements in a docker-compose.yml file. This ensures that every time the service starts, it has the necessary permissions.

services:
  bluetooth-app:
    image: your-image
    network_mode: host
    volumes:
      - /var/run/dbus:/var/run/dbus
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN

BlueZ Version Matching

Ensure the version of bluez (which provides bluetoothctl) inside your container is relatively close to the host’s version. Significant version mismatches can sometimes cause communication errors over D-Bus.

If the error persists after mounting the volume, verify that the Bluetooth service is actually running on the host machine using systemctl status bluetooth.