Changing the Timezone to JST on Alpine Linux
Docker
2021-02-10 00:38 (5 years ago)

Two Implementation Methods
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.
Verification Method
Check if the date command returns JST.
$ date
Wed Feb 10 09:45:26 JST 2021
Difference
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.
Verification Method in Django
./manage.py shell
>>> from django.utils import timezone
>>> timezone.now()
>>> timezone.now().hour
Please rate this article
Current rating: 4.0 (2)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.