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.