Repository server via Docker


I tried to run kopia repository server in a docker container.
First problem is that I wanted to mount a filesystem repository to the repository server - but in the provided docker container there is no (empty) folder for doing this. It somehow worked when mounting in /app/data, but I think it is better to separate data and config files completely, so a /data directory would make sense imho.

Second problem is that, although the server is up and running, it does not seem to be complete.
Create a repository (works)
docker exec -it kopia kopia repository create filesystem --path=/app/data

docker exec -it kopia kopia repository status shows a repository is connected. However, if I want to connect a client it shows:
Unavailable desc = not connected to a direct repository: EOF

Am I missing something? Or do I need something else to run kopia repository server in a container?

Each execution of the container is isolated from the next, so you need to mount /app/config, /app/data (for filesystem repository) and /app/cache on all invocations so that state is shared between them.

See Installation | Kopia

Seems I didn’t fully understand it when I read the documentation the first time.
Thanks for the hint, it works now.
Here is what I did to get docker kopia repository server up an running. Maybe someone might find this useful:

Login to your docker host and create some base directories:

mkdir /srv/kopia
cd /srv/kopia
mkdir {cache,config,data,logs}
chown 65532:65532 {cache,config,data,logs} # kopia container runs in rootless mode
docker run --name kopia -e KOPIA_PASSWORD="yourrepositorypassword" \
           -v /srv/kopia/data:/app/data \				# You only have to mount this if you create a local filesystem for storing the data
           -v /srv/kopia/config:/app/config \
           -v /srv/kopia/cache:/app/cache \
           -v /srv/kopia/logs:/app/logs \
           -v /etc/ssl/certs/yourcert_fullchain.pem:/app/backup.fullchain.pem \  # you can use --insecure for testing or create a self signed cert.
           -v /etc/ssl/private/yourcert_privkey.pem:/app/backup.privkey.pem \
           -p 51515:51515 \
           kopia/kopia:latest server \
           --tls-cert-file /app/backup.fullchain.pem \
           --tls-key-file /app/backup.privkey.pem

In a second screen, during the server is running (upper command), you can execute additional commands for creating the local filesystem or add a user:

docker run -e KOPIA_PASSWORD="yourrepositorypassword" \
           -v /srv/kopia/data:/app/data \
           -v /srv/kopia/config:/app/config \
           -v /srv/kopia/cache:/app/cache \
           -v /srv/kopia/logs:/app/logs \
	   kopia/kopia:latest repository create filesystem \

For adding a user, use the docker arguments as above, but then

           kopia/kopia:latest server user add user1@laptop1 \

If you want to be able to login as “root” (kopia user) to the WebUI, you have to create a user, e.g. kopia@localhost, and then restart the server and append the following argument:

--server-username kopia@localhost

You can go now to your hosts ip address:51515 and login with kopia@localhost and the defined password.