Openhab-cli in a Docker Container

i need to perform a Full configuration Backup to migrate my installation of OH3.3.0 from a docker to a virtual machine.
But I don’t know hot to perform openhab-cli backup into docker container

Any Help?

There is no openhab-cli in the Docker image. But there is a backup script in /openhab/runtime/bin. But you should have your conf and userdata folders mounted as volumes in the container anyway. So just save those two folders and you have a full backup.

and If I save the folder how can I restore on a Classic OH3 installation on a Linux Box?

userdata goes to /var/lib/openhab and conf goes to /etc/openhab.

You might want to clear out the userdata/cache and userdata/tmp folders but that’s probably not strictly necessary.

Just make sure that the new instance of OH is exactly the same as the version the configs are coming from. After the restore you can upgrade but not before.

1 Like

thanks done

Indeed, I even have three folders mounted as volumes:

      - "/zfs/NAS/config/openhab3/addons:/openhab/addons"
      - "/zfs/NAS/config/openhab3/conf:/openhab/conf"
      - "/zfs/NAS/config/openhab3/userdata:/openhab/userdata"

So, you are saying that migrating my docker installation is as easy as copying userdata to /var/lib/openhab (or /var/lib/openhab/userdata?) and conf to /etc/openhab (or /etc/openhab/conf`?) and after that my new instance will work just like the old one? That would be fantastic!

Where do the addons go?

I’m not sure yet, whether I want to migrate to a TrueNAS jail or an openhabian VM, but if I go for the jail, the challenge is that it is rather difficult to create a jail for version 3 now that version 4 is out. So it would make more sense for me to upgrade to 4 first and then migrate. Why are you suggesting the other way around?

Migrating from what to what?

Inside the container it’s /openhab/addons, /openhab/conf and /openhab/userdata. It’s basically a manual install inside the container.

Where those folders live on the disk of the host doesn’t matter. All that matters is where you mount them into the container.

If you are looking to migrate away from Docker to an apt/yum installed instance then you need to make sure the version of OH installed is the same running in the container. Then yes, you’d copy to those folders. For addons, see openHAB on Linux | openHAB