Docker基础镜像时区修改

我们在构建自己的docker镜像时,系统默认一般为UTC,我们需要改为CST

Ubuntu16.04基础镜像: 

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基础镜像:

 

1 FROM alpine3.6
2 MAINTAINER xx@example.cn
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 

 

上一篇:“2018宁夏邀请赛 ” 兼 “The 2019 Asia Yinchuan First Round Online Programming”


下一篇:ICPC Asia HongKong 2017 E题