#拉取镜像
[root@wcbpg ~]# docker pull centos:7.6.1810
[root@wcbpg ~]# docker run -d --name centos76pg -h centos76pg \
> -p 2222:22 \
> --privileged=true \
> centos:7.6.1810 /usr/sbin/init
324f99977717793a6825011075b8b45673e5bd9948a0206fc4c36516837678e0
[root@wcbpg ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
324f99977717 centos:7.6.1810 "/usr/sbin/init" 38 seconds ago Up 37 seconds 0.0.0.0:2222->22/tcp centos76pg
#进入Linux容器
[root@wcbpg ~]# docker exec -it centos76pg bash
# 下载基础源
[root@centos76pg /]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 22307 0 --:--:-- --:--:-- --:--:-- 22526
# 配置epel源
[root@centos76pg /]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 664 100 664 0 0 43 0 0:00:15 0:00:15 --:--:-- 157</
搭建CentOS7.6容器镜像
最新推荐文章于 2024-10-08 22:30:23 发布
本文介绍如何在Docker环境下构建并导出CentOS7.6的容器镜像,通过该镜像创建稳定的运行环境。
摘要由CSDN通过智能技术生成