How to use restore in Docker?


There’s a restore script within a OH3 docker container. When running this script I get an error openHAB is running! Please stop the process before restoring. I cant shutdown the OH service as this would also shutdown the container, how do I properly use the restore script?


You can add a call to the restore script by mounting a script that calls it to /etc/cont-init.d. See the “Executing shell scripts before openHAB is started” section at Docker.

That might work so long as it executes those scripts before the entrypoint script which checks the versions of the configs against the version of OH in the container and performs an upgrade/downgrade if necessary.

Beyond that, since everything needed is maintained outside the container in volumes anyway (unless you didn’t follow the directions in the first place) it’s usually easier to just grab those folders as you backup into a tar file and restore is just an untar, obviously with the container stopped in both cases.