403 on kopia server status

Hi,
I’m running kopia as a docker image with the following docker-compose file:

services:
  kopia:
      image: kopia/kopia:latest
      container_name: kopia
      env_file: .env
      user: "0:0"
      restart: "unless-stopped"
      privileged: true
      ports:
      - 61616:51515
      cap_add:
        - SYS_ADMIN
      security_opt:
        - apparmor:unconfined
      devices:
        - /dev/fuse:/dev/fuse:rwm
      command:
        - server
        - start
        - --disable-csrf-token-checks
        - --address=0.0.0.0:51515
        - --ui
        - --insecure
      volumes:
        - ./sharedtmp:/tmp:shared
        - ./config:/app/config
        - ./cache:/app/cache
        - ./logs:/app/logs
        - ./config:/app/rclone
        - /:/app/backup:ro
      healthcheck:
        test: ["CMD", "/bin/kopia", "server", "status" ]
        interval: 20s
        timeout: 20s
        start_period: 30s

and my .env file contains:

KOPIA_CHECK_FOR_UPDATES=true
KOPIA_SERVER_USERNAME=kopia
KOPIA_SERVER_PASSWORD=**********
KOPIA_PASSWORD=**********
TZ=Europe/Paris

The server starts fine with the container, I can access it for instance with

docker exec -it kopia /bin/kopia server users list

or do whatever I want on the Web UI but the health check fails with a 403 error…
Same if I try to execute it with docker exec like this

docker exec -it kopia /bin/kopia server status

Why the user which starts the server has no right to get its status?
Any clue appreciated…

EDIT: the exact error is:

ERROR unable to list sources: 403 Forbidden

I had the same issue. In case you still have it… I added to the startup arguments --server-control-username=admin, --server-control-password=somepassword.

Then to run a server status, it’s kopia server status --server-control-username=admin --server-control-password=somepassword

Worked for me at least.

Thanks a lot @sfatula it worked for me too…

not working for me :face_with_diagonal_mouth:

@leolivier @sfatula is there any other way I can do a docker healthcheck for my Kopia container please?

Here is my docker compose healthcheck, which sounds like what you are asking for:

    healthcheck:
      test: ["CMD-SHELL", "curl -sSf -u root:mypassword -o /dev/null http://127.0.0.1:51515  || exit 1"]
      interval: 1m
      timeout: 10s
      retries: 5
      start_period: 30s
      start_interval: 5s

where mypassword is the env variable USERPASSWORD

1 Like

@sfatula thanks :+1: