jin771998569關注0人評論1499人閱讀2018-01-19 17:08:40docker
supermin 在Centos7 裏面安裝默認只可以構建Centos7 版本的基礎鏡像,若是想進行構建Centos6基礎鏡像須要對Linux系統進行稍微作一下修改,主要體如今yum的源方面。vim
# yum install supermin5 supermin5-devel -y 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * elrepo: hkg.mirror.rackspace.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 supermin5.x86_64.0.5.1.16-4.el7 將被 安裝 ---> 軟件包 supermin5-devel.x86_64.0.5.1.16-4.el7 將被 安裝 --> 正在處理依賴關係 rpm-build,它被軟件包 supermin5-devel-5.1.16-4.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 rpm-build.x86_64.0.4.11.3-25.el7 將被 安裝 --> 正在處理依賴關係 patch >= 2.5,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 elfutils >= 0.128,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 unzip,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 system-rpm-config,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 perl(Thread::Queue),它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 bzip2,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在處理依賴關係 /usr/bin/gdb-add-index,它被軟件包 rpm-build-4.11.3-25.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 bzip2.x86_64.0.1.0.6-13.el7 將被 安裝 ---> 軟件包 elfutils.x86_64.0.0.168-8.el7 將被 安裝 ---> 軟件包 gdb.x86_64.0.7.6.1-100.el7 將被 安裝 ---> 軟件包 patch.x86_64.0.2.7.1-8.el7 將被 安裝 ---> 軟件包 perl-Thread-Queue.noarch.0.3.02-2.el7 將被 安裝 ---> 軟件包 redhat-rpm-config.noarch.0.9.1.0-76.el7.centos 將被 安裝 --> 正在處理依賴關係 dwz >= 0.4,它被軟件包 redhat-rpm-config-9.1.0-76.el7.centos.noarch 須要 --> 正在處理依賴關係 zip,它被軟件包 redhat-rpm-config-9.1.0-76.el7.centos.noarch 須要 --> 正在處理依賴關係 perl-srpm-macros,它被軟件包 redhat-rpm-config-9.1.0-76.el7.centos.noarch 須要 ---> 軟件包 unzip.x86_64.0.6.0-16.el7 將被 安裝 --> 正在檢查事務 ---> 軟件包 dwz.x86_64.0.0.11-3.el7 將被 安裝 ---> 軟件包 perl-srpm-macros.noarch.0.1-8.el7 將被 安裝 ---> 軟件包 zip.x86_64.0.3.0-11.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ========================================================================================================================================================================= Package 架構 版本 源 大小 ========================================================================================================================================================================= 正在安裝: supermin5 x86_64 5.1.16-4.el7 base 550 k supermin5-devel x86_64 5.1.16-4.el7 base 14 k 爲依賴而安裝: bzip2 x86_64 1.0.6-13.el7 base 52 k dwz x86_64 0.11-3.el7 base 99 k elfutils x86_64 0.168-8.el7 base 279 k gdb x86_64 7.6.1-100.el7 base 2.4 M patch x86_64 2.7.1-8.el7 base 110 k perl-Thread-Queue noarch 3.02-2.el7 base 17 k perl-srpm-macros noarch 1-8.el7 base 4.6 k redhat-rpm-config noarch 9.1.0-76.el7.centos base 79 k rpm-build x86_64 4.11.3-25.el7 base 146 k unzip x86_64 6.0-16.el7 base 169 k zip x86_64 3.0-11.el7 base 260 k 事務概要 ========================================================================================================================================================================= 安裝 2 軟件包 (+11 依賴軟件包) 總下載量:4.2 M 安裝大小:11 M Downloading packages: (1/13): dwz-0.11-3.el7.x86_64.rpm | 99 kB 00:00:00 (2/13): perl-Thread-Queue-3.02-2.el7.noarch.rpm | 17 kB 00:00:00 (3/13): perl-srpm-macros-1-8.el7.noarch.rpm | 4.6 kB 00:00:00 (4/13): patch-2.7.1-8.el7.x86_64.rpm | 110 kB 00:00:00 (5/13): elfutils-0.168-8.el7.x86_64.rpm | 279 kB 00:00:00 (6/13): rpm-build-4.11.3-25.el7.x86_64.rpm | 146 kB 00:00:00 (7/13): redhat-rpm-config-9.1.0-76.el7.centos.noarch.rpm | 79 kB 00:00:00 (8/13): supermin5-devel-5.1.16-4.el7.x86_64.rpm | 14 kB 00:00:00 (9/13): unzip-6.0-16.el7.x86_64.rpm | 169 kB 00:00:01 (10/13): zip-3.0-11.el7.x86_64.rpm | 260 kB 00:00:01 (11/13): supermin5-5.1.16-4.el7.x86_64.rpm | 550 kB 00:00:01 (12/13): gdb-7.6.1-100.el7.x86_64.rpm | 2.4 MB 00:00:24 bzip2-1.0.6-13.el7.x86_64.rpm FAILED http://mirrors.cqu.edu.cn/CentOS/7.4.1708/os/x86_64/Packages/bzip2-1.0.6-13.el7.x86_64.rpm: [Errno 12] Timeout on http://mirrors.cqu.edu.cn/CentOS/7.4.1708/os/x86_64/Packages/bzip2-1.0.6-13.el7.x86_64.rpm: (28, 'Connection timed out after 30001 milliseconds') 正在嘗試其它鏡像。 (13/13): bzip2-1.0.6-13.el7.x86_64.rpm | 52 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 141 kB/s | 4.2 MB 00:00:30 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : unzip-6.0-16.el7.x86_64 1/13 正在安裝 : patch-2.7.1-8.el7.x86_64 2/13 正在安裝 : supermin5-5.1.16-4.el7.x86_64 3/13 正在安裝 : elfutils-0.168-8.el7.x86_64 4/13 正在安裝 : dwz-0.11-3.el7.x86_64 5/13 正在安裝 : gdb-7.6.1-100.el7.x86_64 6/13 正在安裝 : zip-3.0-11.el7.x86_64 7/13 正在安裝 : bzip2-1.0.6-13.el7.x86_64 8/13 正在安裝 : perl-srpm-macros-1-8.el7.noarch 9/13 正在安裝 : redhat-rpm-config-9.1.0-76.el7.centos.noarch 10/13 正在安裝 : perl-Thread-Queue-3.02-2.el7.noarch 11/13 正在安裝 : rpm-build-4.11.3-25.el7.x86_64 12/13 正在安裝 : supermin5-devel-5.1.16-4.el7.x86_64 13/13 驗證中 : supermin5-devel-5.1.16-4.el7.x86_64 1/13 驗證中 : perl-Thread-Queue-3.02-2.el7.noarch 2/13 驗證中 : perl-srpm-macros-1-8.el7.noarch 3/13 驗證中 : bzip2-1.0.6-13.el7.x86_64 4/13 驗證中 : zip-3.0-11.el7.x86_64 5/13 驗證中 : redhat-rpm-config-9.1.0-76.el7.centos.noarch 6/13 驗證中 : gdb-7.6.1-100.el7.x86_64 7/13 驗證中 : rpm-build-4.11.3-25.el7.x86_64 8/13 驗證中 : dwz-0.11-3.el7.x86_64 9/13 驗證中 : elfutils-0.168-8.el7.x86_64 10/13 驗證中 : supermin5-5.1.16-4.el7.x86_64 11/13 驗證中 : patch-2.7.1-8.el7.x86_64 12/13 驗證中 : unzip-6.0-16.el7.x86_64 13/13 已安裝: supermin5.x86_64 0:5.1.16-4.el7 supermin5-devel.x86_64 0:5.1.16-4.el7 做爲依賴被安裝: bzip2.x86_64 0:1.0.6-13.el7 dwz.x86_64 0:0.11-3.el7 elfutils.x86_64 0:0.168-8.el7 gdb.x86_64 0:7.6.1-100.el7 patch.x86_64 0:2.7.1-8.el7 perl-Thread-Queue.noarch 0:3.02-2.el7 perl-srpm-macros.noarch 0:1-8.el7 redhat-rpm-config.noarch 0:9.1.0-76.el7.centos rpm-build.x86_64 0:4.11.3-25.el7 unzip.x86_64 0:6.0-16.el7 zip.x86_64 0:3.0-11.el7 完畢!
拷貝一份yum配置文件centos
cp /etc/yum.conf /home/yum.conf 修改一下 releasever 改成 6 sed -e -i 's/$releasever/6/g' /home/yum.conf
備份yum.repo.d 源bash
cp /etc/yum.repo.d /etc/yum.repo.d_bak sed -e -i 's/^mirrorlist/#mirrorlist/g ;s/#baseurl/baseurl/g;s/$releasever/6/g;s/mirror.centos.org/mirrors.ustc.edu.cn/g' /etc/yum.repo.d/CentOS-Base.repo
# mkdir /home/centos6 -p # cd /home/centos6 # supermin5 -v --prepare bash coreutils -o supermin.d --packager-config /home/yum.conf 能夠安裝一些 yum、vim 等, supermin5 -v --prepare bash coreutils -o supermin.d --packager-config /home/yum.conf # supermin5 -v --build --format chroot supermin.d -o appliance.d # echo 6 > appliance.d/etc/yum/vars/releasever # tar --numeric-owner -cpf centos-6.tar -C appliance.d . # cat centos-6.tar | docker import - registry.mychebao.com:5000/centos-6
docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry.mychebao.com:5000/centos-6 latest 766e94ff309a About an hour ago 235MB
docker push registry.mychebao.com:5000/centos-6 The push refers to repository [registry.mychebao.com:5000/centos-6] 0cb07a03e3df: Pushed latest: digest: sha256:4f6f28a7d6aeefac72dd9457fd5d71ebf2d078958b2c08741d8f4796d78c5cf7 size: 528
©著做權歸做者全部:來自51CTO博客做者jin771998569的原創做品,如需轉載,請與做者聯繫,不然將追究法律責任架構