用supermin5命令构建镜像

使用supermin5命令(若命令不存在则自己安装)构建centos7系统的docker镜像,镜像名称为centos-7,镜像预装yum、net-tools、initscripts和vi命令,构建完成后提交镜像仓库上传操作,并查看此镜像,将以上操作命令及检查结果以文本形式填入答题框。

1.下载supermin5工具:

yum install supermin5 -y

2.准备要安装的软件包并保存在supermin.d目录下:

supermin5 -v --prepare bash yum net-tools initscripts vi coreutils -o supermin.d

3.构建镜像,并保存在applance.d目录下:

supermin5 -v --build --format chroot supermin.d -o appliance.d

4.使用yum安装软件:

echo 7 > appliance.d/etc/yum/vars/releaserver

5.构建网络:

cp /etc/resolv.conf appliance.d/etc

6.开始构建镜像:

tar --numeric-owner -cpf centos-7.tar -C appliance.d/ .

7.将镜像导入容器:

cat centos-7.tar | docker import - 192.168.10.137:5000/centos-7.tar

8.使用docker查看镜像

docker images | grep centos-7.tar

下面为完整步骤:

[root@server ~]# yum install supermin5 -y
Loaded plugins: fastestmirror
docker                                                | 2.9 kB     00:00     
docker/primary_db                                       | 122 kB   00:00     
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package supermin5.x86_64 0:5.1.10-1.2.el7 will be installed
--> Processing Dependency: yum-utils for package: supermin5-5.1.10-1.2.el7.x86_64
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-34.el7 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-34.el7.noarch
--> Running transaction check
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package              Arch         Version                Repository    Size
=============================================================================
Installing:
 supermin5            x86_64       5.1.10-1.2.el7         centos       574 k
Installing for dependencies:
 python-chardet       noarch       2.2.1-1.el7_1          centos       227 k
 python-kitchen       noarch       1.1.1-5.el7            centos       267 k
 yum-utils            noarch       1.1.31-34.el7          centos       113 k

Transaction Summary
=============================================================================
Install  1 Package ( 3 Dependent packages)

Total download size: 1.2 M
Installed size: 4.3 M
Downloading packages:
-----------------------------------------------------------------------------
Total                                           2.7 MB/s | 1.2 MB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-chardet-2.2.1-1.el7_1.noarch                       1/4 
  Installing : python-kitchen-1.1.1-5.el7.noarch                         2/4 
  Installing : yum-utils-1.1.31-34.el7.noarch                            3/4 
  Installing : supermin5-5.1.10-1.2.el7.x86_64                           4/4 
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                         1/4 
  Verifying  : supermin5-5.1.10-1.2.el7.x86_64                           2/4 
  Verifying  : yum-utils-1.1.31-34.el7.noarch                            3/4 
  Verifying  : python-chardet-2.2.1-1.el7_1.noarch                       4/4 

Installed:
  supermin5.x86_64 0:5.1.10-1.2.el7                                          

Dependency Installed:
  python-chardet.noarch 0:2.2.1-1.el7_1  python-kitchen.noarch 0:1.1.1-5.el7 
  yum-utils.noarch 0:1.1.31-34.el7      

Complete!
[root@server ~]# supermin5 -v --prepare bash yum net-tools initscripts vi coreutils -o supermin.d
supermin: version: 5.1.10
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: prepare: bash yum net-tools initscripts vi coreutils
supermin: packages specified on the command line:
  - bash-4.2.46-19.el7.x86_64
  - yum-3.4.3-132.el7.centos.0.1.noarch
  - net-tools-2.0-0.17.20131004git.el7.x86_64
  - initscripts-9.49.30-1.el7.x86_64
  - coreutils-8.22-15.el7.x86_64
supermin: writing supermin.d.ob72v1gc/packages
supermin: after resolving dependencies there are 136 packages:
  - acl-2.2.51-12.el7.x86_64
  - audit-libs-2.4.1-5.el7.x86_64
  - basesystem-10.0-7.el7.centos.noarch
  - bash-4.2.46-19.el7.x86_64
  - binutils-2.23.52.0.1-55.el7.x86_64
  - bzip2-libs-1.0.6-13.el7.x86_64
  - ca-certificates-2015.2.4-71.el7.noarch
  - centos-release-7-2.1511.el7.centos.2.10.x86_64
  - chkconfig-1.3.61-5.el7.x86_64
  - coreutils-8.22-15.el7.x86_64
  - cpio-2.11-24.el7.x86_64
  - cracklib-2.9.0-11.el7.x86_64
  - cracklib-dicts-2.9.0-11.el7.x86_64
  - cryptsetup-libs-1.6.7-1.el7.x86_64
  - curl-7.29.0-25.el7.centos.x86_64
  - cyrus-sasl-lib-2.1.26-19.2.el7.x86_64
  - dbus-1:1.6.12-13.el7.x86_64
  - dbus-libs-1:1.6.12-13.el7.x86_64
  - device-mapper-7:1.02.107-5.el7.x86_64
  - device-mapper-libs-7:1.02.107-5.el7.x86_64
  - diffutils-3.3-4.el7.x86_64
  - dracut-033-502.el7_4.1.x86_64
  - elfutils-libelf-0.163-3.el7.x86_64
  - elfutils-libs-0.163-3.el7.x86_64
  - expat-2.1.0-8.el7.x86_64
  - file-libs-5.11-31.el7.x86_64
  - filesystem-3.2-20.el7.x86_64
  - findutils-1:4.5.11-5.el7.x86_64
  - gawk-4.0.2-4.el7.x86_64
  - gdbm-1.10-8.el7.x86_64
  - glib2-2.42.2-5.el7.x86_64
  - glibc-2.17-105.el7.x86_64
  - glibc-common-2.17-105.el7.x86_64
  - gmp-1:6.0.0-11.el7.x86_64
  - gnupg2-2.0.22-3.el7.x86_64
  - gpgme-1.3.2-5.el7.x86_64
  - grep-2.20-2.el7.x86_64
  - gzip-1.5-8.el7.x86_64
  - hardlink-1:1.0-19.el7.x86_64
  - hostname-3.13-3.el7.x86_64
  - info-5.1-4.el7.x86_64
  - initscripts-9.49.30-1.el7.x86_64
  - iproute-3.10.0-54.el7.x86_64
  - iptables-1.4.21-16.el7.x86_64
  - iputils-20121221-7.el7.x86_64
  - keyutils-libs-1.5.8-3.el7.x86_64
  - kmod-20-5.el7.x86_64
  - kmod-libs-20-5.el7.x86_64
  - kpartx-0.4.9-85.el7.x86_64
  - krb5-libs-1.13.2-10.el7.x86_64
  - libacl-2.2.51-12.el7.x86_64
  - libassuan-2.1.0-3.el7.x86_64
  - libattr-2.4.46-12.el7.x86_64
  - libblkid-2.23.2-26.el7.x86_64
  - libcap-2.22-8.el7.x86_64
  - libcap-ng-0.7.5-4.el7.x86_64
  - libcom_err-1.42.9-7.el7.x86_64
  - libcurl-7.29.0-25.el7.centos.x86_64
  - libdb-5.3.21-19.el7.x86_64
  - libdb-utils-5.3.21-19.el7.x86_64
  - libffi-3.0.13-16.el7.x86_64
  - libgcc-4.8.5-4.el7.x86_64
  - libgcrypt-1.5.3-12.el7_1.1.x86_64
  - libgpg-error-1.12-3.el7.x86_64
  - libidn-1.28-4.el7.x86_64
  - libmnl-1.0.3-7.el7.x86_64
  - libmount-2.23.2-26.el7.x86_64
  - libnetfilter_conntrack-1.0.4-2.el7.x86_64
  - libnfnetlink-1.0.1-4.el7.x86_64
  - libpwquality-1.2.3-4.el7.x86_64
  - libselinux-2.5-11.el7.x86_64
  - libsemanage-2.5-8.el7.x86_64
  - libsepol-2.5-6.el7.x86_64
  - libssh2-1.4.3-10.el7.x86_64
  - libstdc  -4.8.5-4.el7.x86_64
  - libtasn1-3.8-2.el7.x86_64
  - libuser-0.60-7.el7_1.x86_64
  - libutempter-1.1.6-4.el7.x86_64
  - libuuid-2.23.2-26.el7.x86_64
  - libverto-0.2.5-4.el7.x86_64
  - libxml2-2.9.1-5.el7_1.2.x86_64
  - lua-5.1.4-14.el7.x86_64
  - ncurses-5.9-13.20130511.el7.x86_64
  - ncurses-base-5.9-13.20130511.el7.noarch
  - ncurses-libs-5.9-13.20130511.el7.x86_64
  - net-tools-2.0-0.17.20131004git.el7.x86_64
  - nspr-4.10.8-2.el7_1.x86_64
  - nss-3.19.1-18.el7.x86_64
  - nss-softokn-3.16.2.3-13.el7_1.x86_64
  - nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64
  - nss-sysinit-3.19.1-18.el7.x86_64
  - nss-tools-3.19.1-18.el7.x86_64
  - nss-util-3.19.1-4.el7_1.x86_64
  - openldap-2.4.40-8.el7.x86_64
  - openssl-libs-1:1.0.1e-42.el7.9.x86_64
  - p11-kit-0.20.7-3.el7.x86_64
  - p11-kit-trust-0.20.7-3.el7.x86_64
  - pam-1.1.8-12.el7_1.1.x86_64
  - pcre-8.32-15.el7.x86_64
  - pinentry-0.8.1-14.el7.x86_64
  - pkgconfig-1:0.27.1-4.el7.x86_64
  - popt-1.13-16.el7.x86_64
  - procps-ng-3.3.10-3.el7.x86_64
  - pth-2.0.7-23.el7.x86_64
  - pygpgme-0.3-9.el7.x86_64
  - pyliblzma-0.5.3-11.el7.x86_64
  - python-2.7.5-34.el7.x86_64
  - python-iniparse-0.4-9.el7.noarch
  - python-libs-2.7.5-34.el7.x86_64
  - python-pycurl-7.19.0-17.el7.x86_64
  - python-urlgrabber-3.10-7.el7.noarch
  - pyxattr-0.5.1-5.el7.x86_64
  - qrencode-libs-3.4.1-3.el7.x86_64
  - readline-6.2-9.el7.x86_64
  - rpm-4.11.3-17.el7.x86_64
  - rpm-build-libs-4.11.3-17.el7.x86_64
  - rpm-libs-4.11.3-17.el7.x86_64
  - rpm-python-4.11.3-17.el7.x86_64
  - sed-4.2.2-5.el7.x86_64
  - setup-2.8.71-6.el7.noarch
  - shadow-utils-2:4.1.5.1-18.el7.x86_64
  - shared-mime-info-1.1-9.el7.x86_64
  - sqlite-3.7.17-8.el7.x86_64
  - systemd-219-42.el7_4.6.x86_64
  - systemd-libs-219-42.el7_4.6.x86_64
  - sysvinit-tools-2.88-14.dsf.el7.x86_64
  - tar-2:1.26-29.el7.x86_64
  - tzdata-2015g-1.el7.noarch
  - ustr-1.0.4-16.el7.x86_64
  - util-linux-2.23.2-26.el7.x86_64
  - xz-5.1.2-12alpha.el7.x86_64
  - xz-libs-5.1.2-12alpha.el7.x86_64
  - yum-3.4.3-132.el7.centos.0.1.noarch
  - yum-metadata-parser-1.1.4-10.el7.x86_64
  - yum-plugin-fastestmirror-1.1.31-34.el7.noarch
  - zlib-1.2.7-15.el7.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
(1/32): bash-4.2.46-19.el7.x86_64.rpm                   | 1.0 MB   00:00     
(2/32): audit-libs-2.4.1-5.el7.x86_64.rpm               |  80 kB   00:00     
(3/32): centos-release-7-2.1511.el7.centos.2.10.x86_64. |  23 kB   00:00     
(4/32): coreutils-8.22-15.el7.x86_64.rpm                | 3.2 MB   00:00     
(5/32): ca-certificates-2015.2.4-71.el7.noarch.rpm      | 441 kB   00:00     
(6/32): dbus-1.6.12-13.el7.x86_64.rpm                   | 306 kB   00:00     
(7/32): dracut-033-502.el7_4.1.x86_64.rpm               | 321 kB   00:00     
(8/32): glibc-common-2.17-105.el7.x86_64.rpm            |  11 MB   00:00     
(9/32): glibc-2.17-105.el7.x86_64.rpm                   | 3.6 MB   00:00     
(10/32): gnupg2-2.0.22-3.el7.x86_64.rpm                 | 1.5 MB   00:00     
(11/32): grep-2.20-2.el7.x86_64.rpm                     | 344 kB   00:00     
(12/32): info-5.1-4.el7.x86_64.rpm                      | 233 kB   00:00     
(13/32): iptables-1.4.21-16.el7.x86_64.rpm              | 424 kB   00:00     
(14/32): iproute-3.10.0-54.el7.x86_64.rpm               | 526 kB   00:00     
(15/32): iputils-20121221-7.el7.x86_64.rpm              | 152 kB   00:00     
(16/32): initscripts-9.49.39-1.el7_4.1.x86_64.rpm       | 435 kB   00:00     
(17/32): krb5-libs-1.13.2-10.el7.x86_64.rpm             | 843 kB   00:00     
(18/32): libpwquality-1.2.3-4.el7.x86_64.rpm            |  84 kB   00:00     
(19/32): libuser-0.60-7.el7_1.x86_64.rpm                | 398 kB   00:00     
(20/32): openldap-2.4.40-8.el7.x86_64.rpm               | 348 kB   00:00     
(21/32): libsemanage-2.5-8.el7.x86_64.rpm               | 145 kB   00:00     
(22/32): openssl-libs-1.0.1e-42.el7.9.x86_64.rpm        | 949 kB   00:00     
(23/32): nss-3.28.4-15.el7_4.x86_64.rpm                 | 849 kB   00:00     
(24/32): pam-1.1.8-12.el7_1.1.x86_64.rpm                | 714 kB   00:00     
(25/32): python-libs-2.7.5-34.el7.x86_64.rpm            | 5.6 MB   00:00     
(26/32): rpm-4.11.3-17.el7.x86_64.rpm                   | 1.2 MB   00:00     
(27/32): setup-2.8.71-6.el7.noarch.rpm                  | 165 kB   00:00     
(28/32): shadow-utils-4.1.5.1-18.el7.x86_64.rpm         | 1.1 MB   00:00     
(29/32): systemd-219-42.el7_4.6.x86_64.rpm              | 5.2 MB   00:00     
(30/32): util-linux-2.23.2-26.el7.x86_64.rpm            | 1.9 MB   00:00     
(31/32): yum-3.4.3-132.el7.centos.0.1.noarch.rpm        | 1.2 MB   00:00     
(32/32): yum-plugin-fastestmirror-1.1.31-34.el7.noarch. |  30 kB   00:00     
supermin: writing supermin.d.ob72v1gc/base.tar.gz
supermin: renaming supermin.d.ob72v1gc to supermin.d
[root@server ~]# supermin5 -v --build --format chroot supermin.d -o appliance.d
supermin: version: 5.1.10
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: build: supermin.d
supermin: build: visiting supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting supermin.d/packages type uncompressed packages
supermin: build: 136 packages, including dependencies
supermin: build: 26110 files
supermin: build: 12928 files, after removing unreadable files
supermin: build: 12928 files, after matching excludefiles
supermin: build: 12928 files, after adding hostfiles
supermin: build: 12966 files, after munging
supermin: renaming appliance.d.2qpa8lgl to appliance.d
[root@server ~]# echo 7 > appliance.d/etc/yum/vars/releaserver
[root@server ~]# tar --numeric-owner -cpf centos-7.tar -C appliance.d/ .
[root@server ~]# cat centos-7.tar |  docker import - 192.168.10.137:5000/centos-7
sha256:155d78600cc1fdc0482f5c65772a8fcdcde159992c35ac2cbe2e43115f7c9714
[root@server ~]# docker images | grep centos-7
192.168.10.137:5000/centos-7                  latest              155d78600cc1        43 seconds ago      261.5 MB
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值