PUID for non dameon mode docker container has no effect (when entrypoint is "urbackupsrv remove-unknown")

I need to run “urbackupsrv remove-unknown”.
The only way I found with the urbackup docker install is to stop the container with the default entrypoint to run the server and start another one based on the same image but with “/usr/bin/urbackupsrv remove-unknown” as entrypoint.
Is there another way to run remove-unknown foa urbackup docker install? (though I believe supporting running “usrbackupsrv remove-unknown” as a one-shot container entrypoint is good)

This start the remove-unkown fine but I have a permission issue because with this entrypoint the urbackupsrv runs urbackupsrv with uid 101 and my urbackupsrv main container run with PUID=1002 thus my DB are owned by uid 1002
"

It seems to me that when called with remove-unknwon, the container PUID has no effect. Could it be made to run as PUID even when not run as a daemon?

version: '2'

services:
  urbackup:
    image: uroni/urbackup-server:latest
    container_name: urbackup_remove-unknown
    entrypoint: /usr/bin/urbackupsrv remove-unknown
    environment:
        - PUID=1002 # Enter the UID of the user who should own the files here
        - PGID=100  # Enter the GID of the user who should own the files here
        - TZ=Europe/Paris # Enter your timezone
    volumes:
      - /srv/dev-disk-by-label-secure/appdata/docker/urbackup/etc_default_urbackupsrv:/etc/default/urbackupsrv
      - /srv/dev-disk-by-label-secure/appdata/docker/urbackup/var_urbackup:/var/urbackup
      - /srv/dev-disk-by-label-secure/appdata/docker/urbackup/var_log:/var/log
      - /srv/dev-disk-by-label-secure/backup/urbackup:/backups
    cap_add:
      - SYS_ADMIN # Activate the following two lines for BTRFS support

"

I get this output:

docker start -a urbackup_remove-unknown
2024-05-17 19:26:55: Going to remove all unknown files and directories in the urbackup storage directory. Waiting 20 seconds...
2024-05-17 19:27:15: Shutting down all database instances...
2024-05-17 19:27:15: Opening urbackup server database...
2024-05-17 19:27:15: SQLite: recovered 19574 frames from WAL file /var/urbackup/backup_server.db-wal code: 283
2024-05-17 19:27:31: SQLite: recovered 155803 frames from WAL file /var/urbackup/backup_server_files.db-wal code: 283
2024-05-17 19:27:31: SQLite: recovered 3701 frames from WAL file /var/urbackup/backup_server_link_journal.db-wal code: 283
2024-05-17 19:27:32: SQLite: recovered 23085 frames from WAL file /var/urbackup/backup_server_links.db-wal code: 283
2024-05-17 19:27:32: SQLite: recovered 323 frames from WAL file /var/urbackup/backup_server_settings.db-wal code: 283
2024-05-17 19:27:33: SQLite: recovered 19574 frames from WAL file /var/urbackup/backup_server.db-wal code: 283
2024-05-17 19:27:33: SQLite: recovered 323 frames from WAL file /var/urbackup/backup_server_settings.db-wal code: 283
2024-05-17 19:27:33: WARNING: SQLite: statement aborts at 10: [DELETE FROM misc WHERE tkey=?] attempt to write a readonly database errorcode: 8
2024-05-17 19:27:33: ERROR: Error in CQuery::Execute - attempt to write a readonly database  Stmt: [DELETE FROM misc WHERE tkey=?]
2024-05-17 19:27:33: WARNING: SQLite: statement aborts at 9: [INSERT INTO misc (tkey, tvalue) VALUES (?, ?)] attempt to write a readonly database errorcode: 8
2024-05-17 19:27:33: ERROR: Error in CQuery::Execute - attempt to write a readonly database  Stmt: [INSERT INTO misc (tkey, tvalue) VALUES (?, ?)]
2024-05-17 19:27:33: ERROR: LMDB: Failed to open LMDB database file (Permission denied)
2024-05-17 19:27:33: ERROR: LMDB error creating env
2024-05-17 19:27:33: ERROR: Error creating file index
2024-05-17 19:27:33: ERROR: Setting up file index failed
2024-05-17 19:27:33: Error opening files index...
2024-05-17 19:27:33: ERROR: Error cleaning up.
sudo ps -eo user:15,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm  |grep urbackup
systemd-timesy+ 2775637  7.4  0.2  99772  9088 ?        Ssl  19:41:56 00:00:00 urbackupsrv

grep systemd /etc/passwd
systemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin

ls -l /srv/dev-disk-by-label-secure/appdata/docker/urbackup/var_urbackup/fileindex/ 
total 222340
-rw-r--r-- 1 docker_u users 227405824 17 mai   11:11 backup_server_files_index.lmdb
-rw-r--r-- 1 docker_u users    262208 17 mai   16:53 backup_server_files_index.lmdb-lock

Gotcha I don’t know why I did not notice PUID was set in the entrypoint.sh script runs by the default urbackup entrypoint (using usermod, etc).
Seems to me as if the default entrypoint access docker CMD as exec urbackupsrv "$@""
Proper and working way: replace entrypoint: /usr/bin/urbackupsrv remove-unknown by a command: remove-unknown in my urbackupsrv_remove-unknown docker compose.

Case closed and way to call remove-unknown documented (could the docker way to run remove-unknown be added to the server manual?)
Though that would have been great I found no docker way to stop the urbackup server container when I start the remove-unknown one…

log of the working “command: remove-unknown” container:

     

2024-05-17 20:12:55: Going to remove all unknown files and directories in the urbackup storage directory. Waiting 20 seconds...

2024-05-17 20:13:15: Shutting down all database instances...

2024-05-17 20:13:15: Opening urbackup server database...

2024-05-17 20:13:16: SQLite: recovered 19575 frames from WAL file /var/urbackup/backup_server.db-wal code: 283

2024-05-17 20:14:04: SQLite: recovered 155803 frames from WAL file /var/urbackup/backup_server_files.db-wal code: 283

2024-05-17 20:14:04: SQLite: recovered 3702 frames from WAL file /var/urbackup/backup_server_link_journal.db-wal code: 283

2024-05-17 20:14:05: SQLite: recovered 23085 frames from WAL file /var/urbackup/backup_server_links.db-wal code: 283

2024-05-17 20:14:05: SQLite: recovered 323 frames from WAL file /var/urbackup/backup_server_settings.db-wal code: 283

2024-05-17 20:14:06: SQLite: recovered 19575 frames from WAL file /var/urbackup/backup_server.db-wal code: 283

2024-05-17 20:14:06: SQLite: recovered 323 frames from WAL file /var/urbackup/backup_server_settings.db-wal code: 283

2024-05-17 20:14:10: SQLite: recovered 155803 frames from WAL file /var/urbackup/backup_server_files.db-wal code: 283

2024-05-17 20:14:10: Testing if backup destination can handle subvolumes and snapshots...

Testing for btrfs...
(...)