Error loading config: Unable to write to log file. /data/vaultwarden.log

Hi, I’m getting the following vaultwarden error. Could anyone suggest corrections or tests?

Error loading config:
  Unable to write to log file. /data/vaultwarden.log

Method: Docker
OS: Ubuntu 22.04

I am running the container with sudo from with a dedicated vaultwarden user login:

user_vw@server:~$ cd ~/vw-compose
user_vw@server:~$ sudo docker compose up -d

And in that user’s home directory I have:

user_vw@server:~$ ls -lah
drwxrwxr-x 4 user_vw user_vw 4.0K Apr 26 00:25 vw-compose
drwxrwxr-x 6 user_vw user_vw 4.0K Apr 25 21:36 vw-data

With vaultwarden config looking like this:

user_vw@server:~$ nano ~/vw-compose/docker-compose.yml

version: '3'

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    user: 1001:1004
    restart: always
    volumes:
      - /home/user_vw/vw-data:/data
    environment:
      WEBSOCKET_ENABLED: "true"
      LOG_FILE: "/data/vaultwarden.log"

  caddy:
    image: caddy:2
    container_name: caddy
    restart: always
    ports:
      - 80:80  # Needed for the ACME HTTP-01 challenge.
      - 443:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - ./caddy-config:/config
      - ./caddy-data:/data
    environment:
      DOMAIN: "https://vaultwarden.my.domain"  # Your domain.
      EMAIL: "vaultwarden@my.domain"        # The email address to use for ACME registration.
      LOG_FILE: "/data/access.log"

Update:
If I comment out this line:

user: 1001:1004

…then it starts working. I have taken these numbers as output from:

user_vw@server:~$ id -u; id -g
1001
1004

Is that not the right use of the config line?

On the latest build, I had to change the LOG_FILE directive to remove the leading slash AND the quotes. So

LOG_FILE: data/vaultwarden.log

And then the log started getting written to.