What happens to my settings?

I’m running openhab in a docker container. Unfortunately since it went to final version I am experiencing many problems. Every two or three days it happens that obviously something happens to my configuration and openhab is stuck in “wait while installing UI…”.
I don’t know what happens so I would like to learn a little bit more - especially about the userdata directory. Or does anyone directly know this behaviour?
My docker container is started like this:

docker run -itd --name freundx-openhab \
        --user 9001 \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /opt/freundx/dockerscripts/freundx-openhab2/dockervolumes/conf:/openhab/conf \
        -v /mnt/E/dockervolumes/freundx-openhab2/mnt/userdata:/openhab/userdata \
        -v /mnt/E/dockervolumes/freundx-openhab2/mnt/addons:/openhab/addons \
        --net=host \
        openhab/openhab:2.0.0-amd64

From Version 2 beta to the final version I had to recreate these directories and my configuration from scratch. After this it worked for some days but now it is in the same state as before. I already set everything up from scratch twice and now I don’t want to do this a third time before I understand why this happens and how to avoid it.

I already had a look to openhab.log but couldn’t find anything that sounded related to something like this.

Are you using addons.cfg or installing things through PaperUI?

I installed it through paperUI, but currently I’m trying to do it via the configuration.

Is addons.cfg at Version 2 still used? I’m really confused about the different ways of configuration. There is 1. the paperUI way, 2. the way of /openhab/conf/addons directory and 3. some way via addons.cfg.

All these ways are not compatible to each other. Now what is the correct way? And - propably a question to openHab team - why do we have three ways? At my first tries I hoped that I could configure via UI and then export the configuration to config files.

Currently I managed to install milight binding by placing the .jar file of the binding in /addons, additionally added the bulbs in conf/things/default.things.

There is no “correct” way. There are just multiple ways. I should note though that the addons folder is intended strictly for installing add-ons that are not part of the official distro. And adding such addons to the addons folder is not incompatible with the other methods.

Because, despite PaperUI having come a long way, it is not yet feature complete. Also, a lot of people, particularly people coming from OH 1.x, prefer the text based configuration. And I would say, in the case of using Docker, the text based configs provide a little more flexibility.

I beleive the ultimate goal is that PaperUI will be suitable for everything and be the “preferred” method. But the addons.cfg approach will likely remain an option.

Unless you are running a snapshot or development version, you should install thisw binding through PaperUI or addons.cfg.

When using Docker, I use and recommend the addons.cfg file. The reason is that when upgrading the Docker Image the addons will not be updated unless you do so through the karaf console or delete userdata/cache and userdata/tmp. If you use addons.cfg to install your bindings, you can almost completely wipe out your userdata folder (preserve the jsondb folder) and OH will automatically reinstall all your addons and rebuild the userdata folder. If you delete jsondb though you will lose any PaperUI create or autodiscovered Things and Items.

One thing to note is if you start using addons.cfg, you must install everything through it. addons.cfg takes precidence and so if you then try to install an addon through PaperUI it will become uninstalled.

Thanks Rich for clarifying about the /addons folder. I’m now using only addons.cfg and can actually start the docker container with just the /conf folder mounted.

I wouldn’t recommend that appraoch. If you use any binding that does autodiscovery or do any other configuration using PaperUI all of that will be lost when you recreate the container. If it isn’t mounted as a volume, consider it volitile.

You should mount userdata as a volume as well unless you know for sure you will never do anything through PaperUI AND you will never use automatically discovered Things.