HA Docker: Exclude folders from backup

Hi,

I recently moved from Ha ‘Core’ to ‘Docker’. Whilst using ‘Core’ I was able to specify a download directory outside of /config which ensured it’s (large size) wasn’t included in my backup.

With ‘Docker’, the only way (I know of) to use the external directory is to map it to a folder in /config from my docker-compose.yml file:

  homeassistant:
    container_name: homeassistant
    image: homeassistant/home-assistant:stable
    restart: unless-stopped
    volumes:
      - ./homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /mnt/dietpi_userdata/homeassistant_recordings:/config/downloads.  # <- here!
    depends_on:
      - zigbee2mqtt
      - influxdb
    environment:
      - TZ=Europe/London
    network_mode: host
    privileged: true

However, everything in my external folder is now being included in my backup.

Does anyone know of a way to either:

  • exclude the /downloads folder (and it’s mapped external folder)
  • a better way to specify the external folder to keep it from being backed up?

cheers.

For anyone looking for the same thing, I found a HACS integration that will do it:

However, if anyone knows the answer to my question I would certainly like to understand and learn.

edit: The above HACS integration only works with Supervisor.

I can recommend Duplicati

Can I run this on a RPi? will it work even though HA is running (open database etc)?

I run Duplicati as a docker container and this has nothing to do with HA itseld.
On your question and to be fully transparent, I have not tested yet the restore of the HA db… I am using a mariadb solution for HA and just too lazy (for now) to test it out.
Aside HA side I am also backing up other things from my NUC

1 Like