WTH It's not possible to use a non-root account for Docker image

Looks like HA does not support nor want to support using non-root account for HA running in Docker container.
I know it’s already been discussed here:

But it feels like it the WTH month so…

Create a homeassistant user:group on the linux host

Provide proper permission to the user:group

set PUID and GUID environment variables for docker container (incomplete compose example below)

I also recommend using mac vlan so you dont need to use host networking

services:

##########################################
#           HOMEASSISTANT                #
##########################################
  hass:
    container_name: homeassistant
    hostname: homeassistant
    mac_address: "02:42:0a:3c:1b:f1"
    privileged: false
    restart: unless-stopped
    stop_grace_period: 10s
    depends_on:
      - mariadb    
    image: ghcr.io/ghcr.io/home-assistant/home-assistant:2024.11.0
    volumes:
      - "/srv/main/docker/homeassistant/application/config:/config"
      - "/etc/localtime:/etc/localtime:ro"
    ports:
      - "8123:8123/tcp" # HA UI
      - "20165:21065/tcp" #
      - "5353:5353/udp" # mDNS
      - "51837:51827/udp" # homekit
    environment:
      - PUID:"1002"    
      - GUID:"1002"
    networks:
      dockerlocal:
      esphome:
      homeassistant:
      reverseproxy:      
      MacVlan30_Net:
        ipv4_address: "10.88.30.15"

EDIT

Never realized non-root was not supported. Yes. please support this.

The architecture documentation seems pretty clear that this is the intended way to run. HA will not support other setups.

Perhaps you could request using podman instead of docker. Then HA still can require root, but you could have an option to run an unsupported version where you change that.

1 Like

Should we open another WTH thread to request to be able to run home assistant in Podman or can we use this one?

You can create a new one. Reference this one and explain why it is different.

Why not use LinuxServer.io image? They add PUID/PGID support for all the images they build. I use their homeassitant image and Nextcloud, over the official ones. Let me know if you guys have concerns about linuxserver.io.

1 Like

I do use their SWAG container, can’t complain about that one. Never used their home assistant container.

I learned that I when setting PGID and PUID don’t work setting user will.

While some containers won’t function with non root user, homeassistant worked without issue for me.

I couldn’t find the dockerfile that Linuxserver.io builds from. I don’t like to use docker containers that I cannot look at.