I want to set time zone in my docker container. i follow this artical but cant find working solution for alpine base image. Could you please guide me..
I want to set time zone in my docker container. i follow this artical but cant find working solution for alpine base image. Could you please guide me..
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
This is my Dockerfile and it's work:
FROM alpine:latest
# Essentials
RUN apk add -U tzdata
ENV TZ=America/Santiago
RUN cp /usr/share/zoneinfo/America/Santiago /etc/localtime
you have to replace 'America/Santiago' to your timezone'