How to set timezone inside alpine base docker image?

You need to install the tzdata package and then set the enviroment variable TZ to a timezone. (List with all the timezones)

FROM alpine:latest
RUN apk add --no-cache tzdata
ENV TZ=Europe/Copenhagen

Output

$ docker run --rm alpine date
Tue Aug 31 09:52:08 UTC 2021

$ docker run --rm myimage date
Tue Aug 31 11:52:13 CEST 2021

Leave a Comment