构建centos docker基础镜像

1、介绍

比较老的版本docker镜像,不太好找,可以尝试自己构建

各版本构建基础镜像方法不太一样,方式也不同,自己尝试,本文只介绍了我自己的尝试
2、构建centos5.11 docker镜像

准备iso文件

(1)安装操作系统

(2)准备repo镜像

因为官方不在支持选择本地iso的方式构建,使用html,或者ftp最好

(3)生成rootfs

精简版本,安装rootfs 300m

bash 复制代码
yum --installroot=/rootfs install bash coreutils yum centos-release -y

最小安装或者是base版本 900m

bash 复制代码
yum --installroot=/rootfs  groupinstall "Base"

删除yum缓存

rm -rf var/cache/yum/

(4)安装完成后替换自己本地的repo镜像文件

(5)导出rootfs

bash 复制代码
tar --numeric-owner -czf centos5_11-root.tar.gz -C /rootfs/ .

(6)构建docker镜像

dockerfile

bash 复制代码
FROM scratch
ADD ./centos5_11-root.tar.gz /
CMD ["/bin/bash"]

构建

bash 复制代码
docker build -t centos5.11:v1 .

(7)运行容器测试

bash 复制代码
docker run -it centos5.11:v1 /bin/bash

源也是可用的

相关推荐
wdfk_prog5 小时前
[Linux]学习笔记系列 -- hashtable
linux·笔记·学习
CheungChunChiu6 小时前
Linux 内核动态打印机制详解
android·linux·服务器·前端·ubuntu
BlueBirdssh7 小时前
linux 内核通过 dts 设备树 配置pcie 控制器 各种参数和中断等, 那freeRTOS 是通过直接设置PCIe寄存器吗
linux
小目标一个亿8 小时前
Windows平台Nginx配置web账号密码验证
linux·前端·nginx
Aotman_8 小时前
Element-UI Message Box弹窗 使用$confirm方法自定义模版内容,修改默认样式
linux·运维·前端
那些年的笔记9 小时前
Linux屏幕旋转方法
linux·运维·服务器
XiaoHu02079 小时前
Linux网络编程套接字
linux·服务器·网络·git
竹之却10 小时前
CentOS 系列,防火墙相关指令
linux·运维·centos
JadenOliver10 小时前
Docker 守护进程核心配置入口:daemon.json
docker·daemon.json
一颗青果10 小时前
进程组 | 会话 |终端 | 前台后台 | 守护进程
linux·运维·jvm