系统Centos7.2
1.安装febootstrap
下载地址如下:(Centos7上没有febootstrap,不能yum安装,需要下载RPM包)
wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/febootstrap-3.21-4.el6.x86_64.rpm
wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/fakechroot-2.9-24.5.el6_1.1.x86_64.rpm
#wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/febootstrap-supermin-helper-3.21-4.el6_.x86_64.rpm
wget https://www.dwhd.org/wp-content/uploads/2016/06/febootstrap-supermin-helper-3.21-4.el6_.x86_64.rpm
wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/fakechroot-libs-2.9-24.5.el6_1.1.x86_64.rpm
weget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/fakeroot-1.12.2-22.2.el6.x86_64.rpm
wget http://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/fakeroot-libs-1.12.2-22.2.el6.x86_64.rpm
或是在Centos6 服务器上用yumdownloader下载,再拷贝到Centos7上安装
例如:yumdownloader febootstrap
fakeroot
fakeroot-libs
fakechroot
fakechroot-libs
febootstrap
febootstrap-supermin-helper
[root@kubernetes-112 febootstrap]# ll
total 696
-rw-r--r-- 1 root root 23576 Sep 6 15:40 fakechroot-2.9-24.5.el6_1.1.x86_64.rpm
-rw-r--r-- 1 root root 23240 Sep 6 15:40 fakechroot-libs-2.9-24.5.el6_1.1.x86_64.rpm
-rw-r--r-- 1 root root 75112 Sep 6 15:40 fakeroot-1.12.2-22.2.el6.x86_64.rpm
-rw-r--r-- 1 root root 23528 Sep 6 15:40 fakeroot-libs-1.12.2-22.2.el6.x86_64.rpm
-rw-r--r-- 1 root root 209020 Sep 6 15:40 febootstrap-3.21-4.el6.x86_64.rpm
-rw-r--r-- 1 root root 345436 Sep 6 15:40 febootstrap-supermin-helper-3.21-4.el6.x86_64.rpm
*安装
rpm -ivh *.rpm
[root@kubernetes-112 febootstrap]# rpm -ivh *.rpm
warning: fakechroot-2.9-24.5.el6_1.1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:febootstrap-supermin-helper-3.21-################################# [ 17%]
2:fakeroot-libs-1.12.2-22.2.el6 ################################# [ 33%]
3:fakeroot-1.12.2-22.2.el6 ################################# [ 50%]
4:fakechroot-libs-2.9-24.5.el6_1.1 ################################# [ 67%]
5:fakechroot-2.9-24.5.el6_1.1 ################################# [ 83%]
6:febootstrap-3.21-4.el6 ################################# [100%]
2.制作镜像(使用root账号)
febootstrap -i bash -i wget -i yum -i iputils -i iproute -i openssh-server -i openssh-clients -i vim centos7.2 centos7.2-image http://mirrors.aliyun.com/centos/7/os/x86_64/
(-i 安装package, centos7.2 操作系统版本,centos7.2-image安装目录,最后是源地址)
*进入目录
cd docker7.2-image
*生成镜像
不加版本号
tar -c . | docker import - centos7.2-base #不加版本号,显示为latest
加版本号
tar -c . | docker import - centos7.2-base:7.5.1804
*运行容器
docker run -it centos7.2-base /bin/bash
exit
*查看运行状态
docker ps -a
3.上传到harbor register
变更标签
docker tag centos7.2-base:7.5.1804 harbor.nedy.com/atlas/centos7.2-base:7.5.1804
上传到镜像服务器
docker push harbor.nedy.com/atlas/centos7.2-base:7.5.1804