RUN apk --no-cache add tzdata \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& apk del tzdata
Alternatively
ENV TZ=Asia/Tokyo
RUN apk --no-cache add tzdata
Choose one.
Combining the first method with ENV TZ=
does not work well.
Check if the date command returns JST.
$ date
Wed Feb 10 09:45:26 JST 2021
The latter method leaves all time zones within the image.
The size is approximately 3.3 MB.
If your application uses time zones, the latter method is preferable.
./manage.py shell
>>> from django.utils import timezone
>>> timezone.now()
>>> timezone.now().hour
Comments