麦克斯仇
Think different
160
文章
42175
阅读
首页
INDEX
文章
ARTICLE
关于
ABOUT
Docker常用镜像:CentOS制作国内镜像源加速的镜像
创建日期:
2020/02/12
修改日期:
2023/05/26
Linux
Docker
> 以CentOS7.7.1908为例 仓库地址:[https://hub.docker.com/_/centos](https://hub.docker.com/_/centos) docker hub上提供的CentOS镜像使用的yum源为国外的源,可以自己制作使用国内yum源的镜像,方便后续使用此镜像作为基础制作其他镜像。 `Dockerfile`内容如下 ```bash FROM centos:7.7.1908 ENV TZ=Asia/Shanghai RUN curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-7-anon.repo \ && yum clean all \ && yum makecache ``` > 或者使用阿里yum源地址:http://mirrors.aliyun.com/repo/Centos-7.repo 镜像默认时区为`UTC+0`,使用`ENV TZ=Asia/Shanghai`设置中国`UTC+8`时区。 制作镜像: ```bash docker build -t centos-huaweimirror:7.7.1908 . ``` 测试镜像: ```bash # 启动并进入容器 docker run -it --rm centos-huaweimirror:7.7.1908 bash # 查看系统时间和时区 date -R # 退出容器 exit ```
6
全部评论