Restic REST server - docker compose setup - WARNING: No user exists

Hello, I have this restic REST server docker-compose.yml:

---

services:
  restic_rest_server:
    image: restic/rest-server:latest
    container_name: restic_rest_server
    volumes:
      - ./data:/data
    env_file:
      - .env
    ports:
      - "127.0.0.1:${PORT}:8000"

One of variables is:

PASSWORD_FILE = "/data/.htpasswd"

In ./data, I have successfully setup .htpasswd file.

But in docker compose logs, it write a warning that no user is set:

Why does it even says that? The user(s) data is indeed written in .htpasswd.

I did not tested restic server and clients properly. But I believe it should not display warning since users are defined in .htpasswd.

Something is wrong with your .htpasswd file (as it is clear from the output that rest-server uses the correct path to it, /data/.htpasswd).

Verify, inside the container, that the file /data/.htpasswd really does exist and is non-empty, and of course also that it is readable.

If the file does not exist when the container starts, an empty one will be created. So you will probably find an empty /data/.htpasswd file inside the container, and presumably that your ./data/.htpasswd outside of the container still has its contents.

Another potential cause is that your ./data/.htpasswd file is not actually named like that, and has some misspelled name or something.


EDIT: It could perhaps also be that the environment variable PASSWORD_FILE contains something more than the file path, e.g. a space at the end (which would not show in the output), so you ought to check that too.

2 Likes

Thanks for your answer!

You were right, that .htpasswd file was empty. It is created by Ansible (I did not mention that), and first things I needed to do is to recreate this file, which I did not make.

When file is deleted and then again created, it is populated correctly, and the warning is gone.

P. S. I should stop creating issues at midnight.

1 Like

Very good! :slight_smile: