Modified base image Docker time zone

When we build your own docker mirror, the system default is generally UTC, we need to change CST

Ubuntu16.04 base image: 

1 FROM ubuntu:16.04
2 MAINTAINER xx@example
3 RUN ln -sf /usr/share/zoneinfo/Asia/ShangHai /etc/localtime
4 RUN echo "Asia/Shanghai" > /etc/timezone
5 RUN dpkg-reconfigure -f noninteractive tzdata

 Alpine3.6 base image:

 

1 FROM alpine3.6
2 MAINTAINER [email protected]
3 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4 RUN apk add --no-cache tzdata \
5     && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
6     && echo "Asia/Shanghai" > /etc/timezone \
7     &&rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache 

 

Guess you like

Origin www.cnblogs.com/z-ye/p/11355422.html