How to customize the system time of a docker container

Add the following sentence to the Dockerfile (the part marked in red):

FROM xxxxxx
ENV JAVA_OPTS="-Dfile.encoding=UTF-8"
ENV TZ=Asia/Shanghai
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325080688&siteId=291194637