Set timezone in docker image
Problem
You want to set timezone in your docker image.
Solution
As long as your base image installed tzdata, you can set its timezone by using ENV TZ method. Some images don’t have tzdata installed by default like Ubuntu, while others have, like Debian and CentOS.
So a general way is install tzdata first then set the TZ env var:
1 | RUN apt update && apt install tzdata -y |