homebridge / docker-homebridge

Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
https://hub.docker.com/r/homebridge/homebridge/
GNU General Public License v3.0
2.57k stars 241 forks source link

Mounting `/var/run/dbus` for Avahi mDNS causes dbus issues when running in Docker #561

Closed nnhoang closed 1 month ago

nnhoang commented 2 months ago

Analysis

After following the wiki to enable Avahi, I got dbus problems. Docker failed on new containers and some system commands also printed dbus related errors.

Expected Behavior

Docker started to have cgroup errors when running new containers

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: 
unable to apply cgroup configuration: unable to start unit "docker-511dafefeb50591cff0dbd332bf0e8285f95efdc35770477d8874151b4db4083.scope"
(properties [{Name:Description Value:"libcontainer container 511dafefeb50591cff0dbd332bf0e8285f95efdc35770477d8874151b4db4083"} {Name:Slice Value:"system.slice"} {Name:Delegate Value:true} {Name:PIDs Value:@au [11590]} {Name:MemoryAccounting Value:true} {Name:CPUAccounting Value:true} {Name:IOAccounting Value:true} {Name:TasksAccounting Value:true} {Name:DefaultDependencies Value:false}]): Launch helper exited with unknown return code 1: unknown

Other dbus problems:

❯ sudo reboot
Failed to connect to bus: No such file or directory

Steps To Reproduce

I use oznu/homebridge Docker.

docker-compose

  homebridge:
    image: oznu/homebridge
    container_name: homebridge
    restart: always
    network_mode: host
    environment:
      - HOMEBRIDGE_CONFIG_UI_PORT=8581
    volumes:
      - homebridge-config:/homebridge
      # For Avahi mDNS, Linux only, more efficient protocol than Bonjour
      - /var/run/dbus:/var/run/dbus
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
    security_opt:
      - apparmor:unconfined # For Avahi mDNS
    logging:
      driver: json-file
      options:
        max-size: 100mb
        max-file: 2

docker run for new containers would then fail.

Logs

.

Configuration

.

Environment

Process Supervisor

Docker

Additional Context

Image oznu/homebridge

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 month ago

This issue has been closed as no further activity has occurred.