I saw the news of 2023.6.0 introducing network storage for backups. Running in a docker container I am unable to utilize the new feature, but it got me wanting to reconfigure my docker setup to utilize my Synology NAS for backups. Originally I was going to add a new volume to my container pointing to /mnt/nas
that’s managed by the host’s fstab
. The resulting docker container failed to run due to some permission errors so I tried to have the container itself mount the nfs share but this exhausts my knowledge of docker and nfs shares pretty quickly. Based on this stack exchange post, I put together the following docker-compose file.
version: "3.2"
services:
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- ~/test/home-assistant/config:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
- nfs-backups:/config/backups
restart: unless-stopped
privileged: true
network_mode: host
volumes:
nfs-backups:
driver_opts:
type: "nfs"
o: "addr=[nfs-address],nolock,soft,rw"
device: ":/volume1/home-assistant/backups"
It seems to work on the initial backup I created on this fresh home assistant, but I wanted to see if others have tackled this topic and have a more refined or robust way to mount an nfs share for use with backups. I know nfs shares can be fickle and I’d hate to run with something like this only to find out all my backups are corrupt when I need them.