'How to set timezone inside alpine base docker image?
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..
Solution 1:[1]
This works for me
FROM alpine:latest
RUN apk update && apk add 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
Solution 2:[2]
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'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hans Kilian |
| Solution 2 | Dharman |
