mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
Alpine image does not respect TZ environment variable #842
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @snevas on GitHub (Oct 22, 2020).
Alpine image does not respect TZ environment variable
When starting the latest alpine image, UTC time is used. This breaks fail2ban
Your environment
Steps to reproduce
Only changed image: 'bitwardenrs/server' to image: 'bitwardenrs/server:alpine'
Expected behaviour
Would respect TZ-variable
Actual behaviour
Was UTC time (-2 hours)
Relevant logs
'bitwardenrs/server':
'bitwardenrs/server:alpine':
@snevas commented on GitHub (Oct 22, 2020):
Also adding the following volume did not work:
@davidkna commented on GitHub (Oct 22, 2020):
/etc/localtimemight be a symlink. You could try/usr/share/zoneinfo/Europe/Amsterdam:/etc/localtime:roinstead. With podman you could also use either--tz=localor--tz=Europe/Amsterdam.@snevas commented on GitHub (Oct 22, 2020):
@davidkna still does not work. The alpine dockerfile is missing the tz package and hard sets UTC. See: https://quaded.com/docker-apline-configure-timezone/
and
https://github.com/dani-garcia/bitwarden_rs/blob/master/docker/amd64/Dockerfile.alpine
@briffle commented on GitHub (Nov 11, 2020):
By default, alpine does not include the tzdata package. ( https://gitlab.alpinelinux.org/alpine/aports/-/issues/5543 ) It adds 3.5MB of space to the image, which is rather significant compared to the bare alpine image
To use the timezones, you would need to use apk to install tzdata.
@snevas commented on GitHub (Nov 11, 2020):
I think the 3.5MB would justify timezone support. But that's up to @dani-garcia .
Adding the package manually would break my auto-updating and I won't use this image without timezone support because it breaks fail2ban.
@polyzen commented on GitHub (Nov 11, 2020):
Making a read-only bind mount to the host's
/etc/localtimeseems to have worked for me.-v /etc/localtime:/etc/localtime:roshould be the option -- I had manually edited my container'sconfig.v2.jsonto add the mount.@snevas commented on GitHub (Nov 12, 2020):
Retested and confirmed working! No need to add anything to the alpine image 👍
@polyzen commented on GitHub (Nov 13, 2020):
Seems like using the
logtimezone = UTCoption for your jail might be cleaner.