'unable to change timezone

I'm trying to change the timezone of my container into "Europe/paris", I saw I had to set TZ environment variable so I did this, but it doesn't change the timezone..

here's my Dockerfile :

FROM node:latest

RUN mkdir /pind

WORKDIR /pind


ENV TZ Europe/Paris
RUN apt update && apt install tzdata -y

ENV PRODUCTION="true"

COPY ./ ./

RUN npm install

CMD npm run start

and the output of the command date in my container : enter image description here

but the real time in Europe/Paris timezone is 16:21



Solution 1:[1]

For an alpine based image you have to install the tzdata first. (see this issue here)

RUN apk add --no-cache tzdata
ENV TZ Europe/Paris

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 ahsan