基于 Alpine 镜像
FROM alpine:latest
ENV TZ=Asia/Shanghai
RUN apk update
&& apk add tzdata
&& echo "${TZ}" > /etc/timezone
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime
&& rm /var/cache/apk/*
基于 Debian 镜像
# 由于 Debian 镜像中已经包含了tzdata,所以只需添加环境变量TZ即可。
FROM debian:latest
ENV TZ=Asia/Shanghai
基于 Ubuntu 镜像
FROM ubuntu:bionic
ENV TZ=Asia/Shanghai
RUN echo "${TZ}" > /etc/timezone
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime
&& apt update
&& apt install -y tzdata
&& rm -rf /var/lib/apt/lists/*
标签:TZ,ENV,etc,&&,Ubuntu,镜像,dockerfile,Debian
From: https://www.cnblogs.com/devopsyyds/p/16893436.html