Docker 2.5.0: Any suggestion fo rbest update practice

You can’t run a restore when openHAB is running.

The only thing the container runs is openHAB.

As long as the container is running you can’t do the restore and if the openHAB is not running the container is not running and exec -it doesn’t have a running container to execute the command in.

You might be able to execute the command in the container using

docker run -it openhab /openhab/runtime/bin/restore

I don’t know if the entrypoint script that kicks off openHAB executes in that case or if just the command you pass in does. You can try it, but you have another problem. /home/pi/openhaby/userdata/backup/myBackup.zip doesn’t exist inside the container. The whole point of a container is to constrain what the software inside it can see and do. It can’t see your /home/pi folder. So even if the command worked it wouldn’t be able to find the backup file to restore.

Honestly, I don’t see the point of trying to use the backup and restore scripts with a Docker container. You already should be mounting volumes to userdata and conf. Just tar up those folders you mount as volumes into the container and you have a backup. To restore the backup untar those folders and change the volume mounts to use the untared folders instead of what ever you are using now.

Over all, I recommend taking a small online course or read up on some Docker and containerized computing basics if you plan on continuing to run openHAB (or anything else) in Docker.

1 Like

Thanks @rlkoshak

hi is it possible to run the Script directly with a rule

My rule is has include the follow code but it don´t work. If i use the command in the sh console it works fine.

executeCommandLine (“sudo docker exec -it 011_0_openhab2 runtime/bin/backup”)

in the Docker Container only the Command “runtime/bin/backup” work but not in my rule with the follow code
executeCommandLine (“runtime/bin/backup”)