HA running with docker-compose silently exits with code 0

Dear Community,

I have two instances of Home assistant - one running on my server at home (intel CPU) and one running on RPI 3B, both running Dietpi (modified debian) as base OS. Currently running the latest version (the last run of “docker-compose pull” was just a week ago).

Even though I configured both computers in (almost) exactly the same way, on the RPI hass in docker works perfectly, on the intel CPU it just exits after some time running. (edit: before exiting, it works perfectly, too - the only problem is, that it suddenly exits)

Few months ago, I installed the RPI following this guide:

https://www.reddit.com/r/homeassistant/comments/895iw6/my_home_assistant_setup_rpi_3b_docker_compose/

With minor tweaks this install works flawlessly and brings me a lot of joy - even though I basically only use it to turn on the heating before we leave for our WE house.

When installing on the intel CPU, I changed the docker compose yaml file to pull the home assistant for amd64, however after running for some time (several hours to days), the docker silently stops working - as far as I can tell with graceful exit.

The docker-compose.yaml on the intel CPU contains:

version: '2.1'
services:
  homeassistant:
    container_name: homeassistant
    image: homeassistant/home-assistant
    network_mode: "host"
    volumes:
      - /home/hass/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

  mosquitto:
    container_name: mosquitto
    image: eclipse-mosquitto
    user: "1000:1000"
    ports:
      - 1883:1883
      - 9001:9001
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/hass/mosquitto:/mosquitto/config:ro
      - /home/hass/mosquitto:/mosquitto/data
    restart: unless-stopped

HASS is started by systemd on startup

[Unit]
Description=Docker Compose Opt Service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/hass/
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose stop
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

the log shows

2022-04-04 22:04:51 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
2022-04-05 01:25:45 WARNING (Thread-4) [homeassistant.components.mqtt] Disconnected from MQTT server 192.168.5.5:1883 (7)
[finish] process exit code 0
s6-svscanctl: fatal: unable to control /var/run/s6/services: supervisor not listening
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

I have tried:

  • removing the custom components
  • running without mqtt
  • running with mqtt and frigate
  • starting manually as user hass
  • using healthcheck in yaml (test: [“CMD”, “curl”, “-f”, “http://127.0.0.1:8123”]
  • privileged: true
  • different “restart” criteria (always, unless-stopped, etc.)
  • not using “network_mode: host”
  • a lot of other stupid ideas that I forgot to mention …

What other relevant info I shall provide? What totally gets me is, that I have two completely same setup (apart from architecture) - Dietpi, docker-compose, home assistant + mqtt and on one computer it works, on other it does not.

Thanks in advance.

With setting restart: always and docker (not docker-compose) being an enabled systemd service, there’s no need for a docker-compose unit.

Maybe their interfere.

Why is that, you are using the „core“ container version, not the supervised one?

I think this is the problem, thanks for pointing this out. I followed the guide for RPI3, where it works without problems. As I adjusted the container image for intel CPU, I obviously chose the wrong one.

I used docker system prune, then followed Alternative - Home Assistant at the end, and started docker-compose.

I noticed several new lines in logs:

2022-04-09 00:17:29 WARNING (Recorder) [homeassistant.components.recorder.migration] Database is about to upgrade. Schema version: 24
2022-04-09 00:17:29 WARNING (Recorder) [homeassistant.components.recorder.migration] Adding columns attributes_id to table states. Note: this can take several minutes on large databases and slow computers. Please be patient!
2022-04-09 00:17:29 WARNING (Recorder) [homeassistant.components.recorder.migration] Adding index `ix_states_attributes_id` to database. Note: this can take several minutes on large databases and slow computers. Please be patient!

Hopefully that means that I run now the supervised version…
I will report back in few days to report if it works or not.

OK, so it must have been the docker image. Since I changed to ghcr.io, it just works.

Note for anyone searching for this error:

The docker image “homeassistant/home-assistant” was to blame for these silent exits. I have switched to “Package home-assistant · GitHub”, and the docker-compose unit (still just a single unit) works for over two days without a problem. Thanks to @m0wlheld for helping me out here.

As to why the homeassistant/home-assistant did not work…