WTH: Make a docker volume redirect in an addon

It would be great in the addon config.yaml to be able to specify a volume mount to redirect to /data/

For instance: a docker image may expect the user to set a redirect/volume to db from /var/noisedash/db: as in GitHub - kaythomas0/noisedash: Self-hostable web tool for generating ambient noises

volumes:
      - db:/var/noisedash/db

But this cannot easily be redirected to the /data/ persistent directory of an homeassistant addon.

Why not have an option in the addon config.yaml to easily force external docker images to redirect to db to /data/ directory. Would make integrating more addons much easier

something like this:

volume_redirect:
  /var/noisedash/db: /data/db

The addon developer would need how to do this, but much easier than current workarounds.

An addon is supposed to work on any Home Assistant system. How can you guarantee your random path exists and contains what you’d expect on all 150k+ os and supervised installs?

Supervisor is not going to provide a way to bind mount random paths as it can’t guarantee that works everywhere. That’s why it only allows addon devs to choose from specific folders that it knows exist on all HA systems.

I think we are talking past each other. I want to point a “random path” that is INSIDE the docker container (not on the homeassistant host) to /data (or /share/, /ssl) on the homeassistant host. If the path is not available inside the docker container, no biggie, the image just will not work right.

Sounds like you just want a link. So then you can move the db into /data and the software can still think it’s writing to /var or wherever. Just do that in your Dockerfile.

yeah, that is what I want. I’ve tried that a few times and get hung up with permissions. I’ll try it again.

Oh right I’m sorry you can’t do that in the Dockerfile since a persistent volume gets mounted in /data. That’s one you have to do in the cont-init setup script like this addon:

Or if you don’t use s6 then in whatever script you run as CMD.

Tbh now that I know what your asking for I don’t think it’s possible for supervisor to do what you want. If supervisor bind mounted some folder in /var to some folder within /data then that part of /data would no longer be persistent. It would totally defeat the point of the task (to make the db survive addon restarts). Linking during setup is really the only way to do what you want to do here.

ok.I’ll look at that script. My addons are pretty basic, so haven’t explored the special scripts in /etc/ . Thanks for the pointer