Alpine设置中国时区
# alpine
# 设置时区为上海
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
Centos设置中国时区
# Centos
ENV TIME_ZONE=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
Ubuntu设置中国时区
# Ubuntu
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
评论(0)