9

Docker Ubuntu 镜像调整为中国时间

 2 years ago
source link: https://www.jansora.com/notebook/107552
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Docker Ubuntu 镜像调整为中国时间闲文杂记Docker Ubuntu 镜像调整为中国时间 导航前往主站应用闲文杂记代码在线代码魔方房价浅析

构建镜像时解决

FROM ubuntu:20.04

# 解决中文乱码问题
ENV LANG C.UTF-8
ENV LC_CTYPE=C.UTF-8


RUN apt update
RUN apt install tzdata -y


# 添加时区环境变量,亚洲,上海
ENV TimeZone=Asia/Shanghai
# 使用软连接,并且将时区配置覆盖/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime
RUN echo $TimeZone > /etc/timezone

WORKDIR /root

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK