常用linux操作系统镜像时区更改

常用linux操作系统设置时区东八区:timedatectl set-timezone Asia/Shanghai

alpine 镜像

FROM alpine:3.18.2

#更换Alpine源为mirrors.ustc.edu.cn
RUN echo http://mirrors.ustc.edu.cn/alpine/v3.18/main > /etc/apk/repositories && \
    echo http://mirrors.ustc.edu.cn/alpine/v3.18/community >> /etc/apk/repositories

# 安装常用命令及更改时区为东八区上海时区:+0800
RUN apk update && apk upgrade && \
    apk add curl bash bash-completion  tree tzdata busybox-extras  && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    apk del tzdata 

centos 镜像

包含字体、jdk安装

#基础镜像为centos
FROM centos:centos8
#simhei.ttf 黑体、simsun.ttc 宋体
#COPY font-win  /usr/share/fonts/font-win
COPY font-win-sim  /usr/share/fonts/font-win-sim
RUN rm -rf /etc/yum.repos.d/*  && curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --enable PowerTools && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm && \
#安装JDK
yum install -y java-1.8.0-openjdk.x86_64 java-devel ffmpeg  && \
#清除yum缓存
yum clean all && \
fc-cache -fv && \

#更改时区为东八区上海时区:+0800
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Debian 镜像

FROM bitnami/minio:2023.6.9
#切换root修改时区
USER root
RUN  rm -rf /etc/localtime &&   ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#切换回原有用户
USER 1001
You have mail in /var/spool/mail/root

Ubuntu镜像

ubuntu镜像:

FROM  elasticsearch:7.17.10
#切换root修改时区
USER root
RUN apt update && apt install --reinstall tzdata -y && apt clean all &&  apt autoremove &&  rm -rf /etc/localtime &&   ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#切换回原有用户
USER 1000

ubuntu操作系统:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值