Setting timezone

Hello,
I have a timezone problem on vaultwarden. Though it is not important, it makes it difficult to analyze vw logs together with those of nginx for instance : I have tried to set the env variable in the container, but it seems to be overridden by config.json file, which appears to not set the timezone. Should I edit that file ?

The Timezone isn’t set via the config.json file, neither saved.
You should set it by adding the TZ variable using the correct timezone. Depending on how you are running Vaultwarden you probably need to docker-compose up -d or stop, remove, run the container again.

Thanks for that (very) fast answer. I have tried setting it with portainer, with no success

I have also tried TZ instead of TIME_ZONE.
I’m on a pi 4 with 64-bit Raspi OS.

I think it is a problem with my understanding of how to re-create a container with portainer : I have tried changing other variables and they seem not to have been taken into account.

Once you create a container you can simply delete the container and recreate it with the new settings. Certain data will persist if you have volumes set up such as the ./vw-data and your config.json file which will override any other CLI defined settings where they overlap at the container creation.

Containers are designed to be ephemeral and the os and other config can be easily brought down, load-balanced, and recreated as needed with data persisting on separate storage in certain scenarios.

Hopefully once you recreate the new container with the correct tz variable settings it’ll show logs correctly.

I succeeded in creating a new container with the right timezone. Thanks !
Now my problem is trying to create it with docker-compose. Here is my docker-compose.yml

version: '3'

volumes:
  data:

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: always
    ports:
      - 127.0.0.1:8080:80
      - 127.0.0.1:3012:3012
    environment:
      - WEBSOCKET_ENABLED=true
      - SIGNUPS_ALLOWED=false
      - DOMAIN=xxx
      - SMTP_HOST=xxx
      - SMTP_FROM=xxx
      - SMTP_PORT=xxx
      - SMTP_SSL=true
      - SMTP_USERNAME=xxx
      - SMTP_PASSWORD=xxx
      - ADMIN_TOKEN=xxx
      - LOG_FILE=/data/vaultwarden.log
      - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      - TIME_ZONE="Europe/Paris"
    volumes:
      - data:/data

It doesn’t work for setting the ports : I guess I have a syntax problem.
And my volume is named vaultwarden, but if I set it to vaultwarden a new vaultwarden_vaultwarden is created instead. This is why I named it data, so the volume created is named vaultwarden_data …

Your ports section should look like this:

ports:
   - 8080:80
   - 8443:443

And the time zone variable should be :


environment:
      - TZ="Europe/Paris"

And what is the path variable ???

And are you sure the data volume is persistent after a recreation of the container ?

You should learn a bit more about docket-compose.yml file :innocent: