设置apk的国内镜像源
echo "https://mirrors.aliyun.com/alpine/v$(cat /etc/alpine-release | cut -d. -f1,2)/main" > /etc/apk/repositories
echo "https://mirrors.aliyun.com/alpine/v$(cat /etc/alpine-release | cut -d. -f1,2)/community" >> /etc/apk/repositories
安装
apk add --no-cache tzdata
设置时区
export TZ=Asia/Shanghai
date
镜像制作
FROM alpine
USER root
RUN set -eux; \
echo "https://mirrors.aliyun.com/alpine/v$(cat /etc/alpine-release | cut -d. -f1,2)/main" > /etc/apk/repositories; \
echo "https://mirrors.aliyun.com/alpine/v$(cat /etc/alpine-release | cut -d. -f1,2)/community" >> /etc/apk/repositories; \
apk update; \
apk add --no-cache tzdata; \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
echo "Asia/Shanghai" > /etc/timezone