Mute Home Assistent (stdout/stderr)

I use HA in a container with the parameters

docker run -v /opt/home-assistant/config:/config --net=host \
    homeassistant/home-assistant

This generates a lot of output on stdout/stderr. Can one mute this with a command line or configuration option?

You can try appending

> /dev/null 2>&1

to the command you want to silent

out of interest, why do you want to not display these?
I personally use docker-compose with the -d parameter so it runs in the background so no output printed at all.
Let me know if you want to know more

You should run it in --detached mode instead.

:+1:

Thank you for reminding me that there still is the Bash in the image! :slight_smile: Eventually, I was successful with

docker run homeassistant/home-assistant \
    bash -c "exec python -m homeassistant --config /config 2> /dev/null"

The only downside is that I copied the current CMD of the Dockerfile into my own setup. If the HA team would change the “python -m homeassistant --config /config”, I probably must change that, too. But for the time being, I can live with that.

P.S.: In case anybody wonders about the “exec”: It is needed so that HA becomes process #1 and can handle SIGTERM. Bash doesn’t do that while a child is running, so the container could only be killed ungracefully.

I find it way too verbose. I rather use the logfile instead. The plan is to mute only stderr and set /dev/stdout as the logfile.

1 Like

By the way: The container is actually launched by Kubernetes. Kubernetes uses stdout+stderr output as the standard log.

But you can launch your container in --detached mode, and use docker logs to view the logs. there is no need to leave it actively in the foreground.