I am able to manually start the Home Assistant Docker container and its companion Matter container without issue. My Docker installation is running as root (which is the default for Docker to my knowledge), so I have to use sudo
to start the container (e.g., sudo docker compose up matter-server -d
).
However when I try to start the container using systemd the Matter container fails to load any nodes and thus the devices become 'Unavailable' in Home Assistant:
(MainThread) INFO [matter_server.server.device_controller] Loaded 0 nodes from stored configuration
and also a new warning from Docker about no HOME environment variable being set comes up while the container is starting:
WARNING time="2024-05-22T02:26:17-07:00" level=warning msg="The \"HOME\" variable is not set. Defaulting to a blank string."
Here is my systemd service:
[Unit]
Description=Restart Home Assistant Matter server
[Service]
ExecStart=docker compose down matter-server && docker compose up matter-server -d
WorkingDirectory=/path/to/my/docker/compose/file/
Why is the Matter container failing to find nodes when started with systemd?
How should I start the Matter container using systemd?