I am building an addon using a single volume one time deployment docker image, only using host networking. It starts and works OK, but as soon as i restart the addon, alle changes made inside the docker image are lost. I assume the supervisor message “Cleaning addon application” is responsible for this? How can i make sure supervisor is only restarting the container leaving everything else as-is?
I think, just like with Docker, you need to specify where persistent data is stored.
No that’s not it. From the author:
I have no idea what HA may be trying to do as it is not something I use. From your description it seem it is restoring the docker image back to original (or redeploying it) so of course all changes to its file system will be lost.
DH was only ever intended for simple single volume one time deployment.
Where DH = Deep Harmony, a roon extension
EDIT: this is what i use to run the docker image https://github.com/posixx/hass_addons/tree/master/roondeepharmony
I don’t know how HAS OS environment works but it does use Docker. You typically run a container with -rm which wipes and starts new each time. Therefore you must specify a volume to save volatile data. I don’t know exactly what HAS OS is doing but it seems clear that every addon I have used is storing volatile data somewhere in the config folder and does not rely on stuff continuing in the container itself. Maybe this can be changed but it doesn’t seem like best practice given that the container has to be rebuilt with every new release.
Ok thanks for the info. The developer of the docker image cannot change behaviour so if HA doesn’t have the option to NOT clean the image (don’t use the -rm flag) it will stop here. The docker image of DH does update itself so after installing it as HA addon it will never be updated through addon store and thus without the -rm flag it will work after every reboot.
If HA is using docker it should offer the option to not clean the image right?
I am not certain that there isn’t such an option, only explaining why it may not be a great idea. HAS OS is a bit of a black box to me although I’m sure there’s documentation out there. That’s one reason I choose not to run HAS OS and just run HA in a Docker container that I manage. You lose the option of having plugins but the few I use (Node-red, ZWAVEJS2MQTT) I have been able to stand up in containers as well and they work the same as a plugin. With Portainer and Watchtower I actually spend less time administering the system than I did before. This might be a way for you to go also.
I gave up and installed a fedora coreos device running the docker image on that. Fixed now.