Without having any prior experience with existdb,
I would propose two different solutions to your problem:
1. If the distroless you are trying to run a shell, supports a :debug
tag, you can create a new container with that tag (and same version). This will contain the shell. Then just copy (using docker cp
) the /bin/sh
from there into the host machine and from the host machine to the original container. Regarding the jar or anyother tool, you can upload it with docker cp
again from your host into the container and execute it inside the container.
2. What you are tying to perform inside the container, you could equally perform it outside of it onto your host. Docker containers filesystem exists also on the host machine (at least on linux). There are two ways to print the path to which you can access the filesystem of the container:
- a.
docker inspect your-container-name | jq '.[0].GraphDriver.Data.MergedDir'
- example result:
var/lib/docker/overlay2/800fd7f2187cbd0be9d1e430ac34efc431c6efb183be45a59c705a4821d362da/merged
- b.
echo "/proc/$(docker inspect -f '{{.State.Pid}}' your-container-name )/root"
- example result:
/proc/3446/root
To access the above directories you will most probably need to switch to root.
(Before the step below you can first backup the contents from one of the two directories above.)
Then execute the command (from your host) e.g.:
java -jar start.jar client --no-gui --xpath "system:restore('/lib/docker/overlay2/800fd7f2187cbd0be9d1e430ac34efc431c6efb183be45a59c705a4821d362da/merged/mylocationwithbackupsinsideconatiner', '', '')"
Now I guess there is a default url to which the tool connects for adding the data from the backup directory. This can change with -ouri
flag. In any case the port of the database to which the start.jar
or any other script connects needs to be exposed to the host.
P.S. if you know that the file you want to restore from, exists inside a volume, you can simply print the path of that volume on the host with:
docker inspect -f '{{ .Mounts }}' your-container-name
- possible result:
/var/lib/docker/volumes/7492ae0c0198d18d0954c834d5bba3167d0f162868e7271d571ff62fb1f5b034/_data /mountpath
P.S 2
I don't know up to which version the start.jar
was used for backup/restore. In the latest version (https://github.com/eXist-db/exist/releases (exist-distribution-6.2.0-unix.tar.bz2
)) I see that there is a script: bin/backup.sh
supporting both backup and restore (-r
flag) and by default reads configuration from etc/backup.properties
. It is also mentioned here: https://exist-db.org/exist/apps/doc/backup (section: using the command line utility)