Skip to content

Several improvements#43

Open
altserg wants to merge 3 commits intotribut:masterfrom
altserg:master
Open

Several improvements#43
altserg wants to merge 3 commits intotribut:masterfrom
altserg:master

Conversation

@altserg
Copy link
Copy Markdown

@altserg altserg commented Jan 9, 2026

1. Added possibility to specify the user name, instead of default homeassistant
2. Added possibility to pass extra options to HASS
3. Added chown to the user:group before dropping root capabilities

HASS still complaints about followinf issue, do not know how to fix it. Tried many ways playing with caps, all fail.
Missing required permissions for Bluetooth management: Missing NET_ADMIN/NET_RAW capabilities for Bluetooth management.
Automatic adapter recovery is unavailable. Add NET_ADMIN and NET_RAW capabilities to the container to enable it

Sample docker-compose file:

services:
  hass:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    restart: unless-stopped
    stop_grace_period: 30s

    volumes:
      - /home/hass/hass:/config:rw
      - /home/hass/tmp/docker/run:/etc/services.d/home-assistant/run:ro 
      - /home/hass/tmp/hass-venv:/var/tmp/homeassistant-venv:rw 
      - /etc/localtime:/etc/localtime:ro 
      - /run/dbus:/run/dbus:ro 
     tmpfs: 
      - /tmp:rw,noexec,nosuid,size=64m

    privileged: true
    security_opt:
      - no-new-privileges=true
      - apparmor=docker-default 
     cap_drop: 
       - ALL 
      cap_add: 
        - NET_ADMIN 
        - NET_RAW

    network_mode: host

    group_add:
      - dialout  # Dialout group

    environment:
      - TZ=Europe/Amsterdam
      - USER=hass 
      - PUID=1004 
      - PGID=1004 
      - UMASK=007 
      - PACKAGES=iputils 
      - HASS_OPTIONS=${HASS_OPTIONS} 
      - UV_LINK_MODE=copy 
      - PIP_CACHE_DIR=/var/tmp/homeassistant-venv/.pip-cache

    1. Added possibility to specify the user name, instead of default homeassistant
    2. Added possibility to pass extra options to HASS
    3. Added chown to the user:group before dropping root capabilities

    HASS still complaints about followinf issue, do not know how to fix it. Tried many ways playing with caps, all fail.
    Missing required permissions for Bluetooth management: Missing NET_ADMIN/NET_RAW capabilities for Bluetooth management.
    Automatic adapter recovery is unavailable. Add NET_ADMIN and NET_RAW capabilities to the container to enable it

    Sample docker-compose file:

    services:
      hass:
        container_name: homeassistant
        image: "ghcr.io/home-assistant/home-assistant:stable"
        restart: unless-stopped
        stop_grace_period: 30s

        volumes:
          - /home/hass/hass:/config:rw
          - /home/hass/tmp/docker/run:/etc/services.d/home-assistant/run:ro
          - /home/hass/tmp/hass-venv:/var/tmp/homeassistant-venv:rw
          - /etc/localtime:/etc/localtime:ro
          - /run/dbus:/run/dbus:ro
          - /run/hass:/run/hass
        tmpfs:
          - /tmp:rw,noexec,nosuid,size=64m

        privileged: true
        security_opt:
          - no-new-privileges=true
          - apparmor=docker-default
        cap_drop:
          - ALL
        cap_add:
          - NET_ADMIN
          - NET_RAW

        network_mode: host

        group_add:
          - dialout  # Dialout group

        environment:
          - TZ=Europe/Amsterdam
          - USER=hass
          - PUID=1004
          - PGID=1004
          - UMASK=007
          - PACKAGES=iputils
          - HASS_OPTIONS=${HASS_OPTIONS}
          - UV_LINK_MODE=copy
          - PIP_CACHE_DIR=/var/tmp/homeassistant-venv/.pip-cache
Requires following changes in docker-compose.yaml:

read_only: true
tmpfs:
 - /run:rw,size=4m,mode=0755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant