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
    

    评论栏