Quick Fix: Home Assistant Docker High CPU Usage

Quick Fix: Home Assistant Docker High CPU Usage

Recently I was confronted with the problem that Home Assistant running in the docker causes 100% CPU load a few minutes after startup, and it doesn't improve afterwards. After several hours of searching I found the solution.

I don't want to waste any more of your time, so here's the solution:

Define the DNS servers in the Docker Compose file, like this:

    dns:
      - 8.8.8.8
      - 1.1.1.1

The complete Docker Compose for Home Assistant looks like this:

services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /mnt/Docker/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    dns:
      - 8.8.8.8
      - 1.1.1.1
    restart: always
    privileged: true
    network_mode: host
    cpus: 2.5
    mem_limit: 5G

If you have modified the file, don't forget to re-read it with Docker. If you are using Portainer, click on the "Update the stack" button after modifying:

That's all.

If you found this article useful and would like to show your appreciation, please consider making a small donation via PayPal. Your support will allow me to continue creating valuable content and make my blog even better. Thank you for your contribution!

Comments