美文网首页
supermin5构建镜像

supermin5构建镜像

作者: home2_d685 | 来源:发表于2020-07-20 20:05 被阅读0次

    Docker使用supermin5工具构建镜像

    1 针对于这个案例,我们首先安装我们的supermin5 工具

    [root@server media]# yum install -y supermin5
     Loaded plugins: fastestmirror
     centos                                                                                                          | 3.6 kB  
     00:00:00     
     docker                                                                                                          | 2.9 kB  
     00:00:00     
     Loading mirror speeds from cached hostfile
     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                                                                                                   49 MB/s | 1.2 MB  
     00: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!
    

    2 下面开始使用supermin5制作我们所需要的镜像所需的安装包。下面命令是准备要安装的软件包并保存在supermin.d目录下

    [root@server media]# 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
        - initscripts-9.49.30-1.el7.x86_64
        - coreutils-8.22-15.el7.x86_64  
      supermin: writing supermin.d.1tcmz1m8/packages
      supermin: after resolving dependencies there are 135 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_6
        - 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
        - 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): audit-libs-2.4.1-5.el7.x86_64.rpm                                                                       |  80 kB  00:00:00     
    (2/32): ca-certificates-2015.2.4-71.el7.noarch.rpm                                                              | 441 kB  00:00:00     
    (3/32): centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm                                                      |  23 kB  00:00:00     
    (4/32): coreutils-8.22-15.el7.x86_64.rpm                                                                        | 3.2 MB  00:00:00     
    (5/32): bash-4.2.46-19.el7.x86_64.rpm                                                                           | 1.0 MB  00:00:00     
    (6/32): dbus-1.6.12-13.el7.x86_64.rpm                                                                           | 306 kB  00:00:00     
    (7/32): glibc-2.17-105.el7.x86_64.rpm                                                                           | 3.6 MB  00:00:00     
    (8/32): gnupg2-2.0.22-3.el7.x86_64.rpm                                                                          | 1.5 MB  00:00:00     
    (9/32): grep-2.20-2.el7.x86_64.rpm                                                                              | 344 kB  00:00:00     
    (10/32): glibc-common-2.17-105.el7.x86_64.rpm                                                                   |  11 MB  00:00:00     
    (11/32): dracut-033-502.el7_4.1.x86_64.rpm                                                                      | 321 kB  00:00:00     
    (12/32): info-5.1-4.el7.x86_64.rpm                                                                              | 233 kB  00:00:00     
    (13/32): iptables-1.4.21-16.el7.x86_64.rpm                                                                      | 424 kB  00:00:00     
    (14/32): iputils-20121221-7.el7.x86_64.rpm                                                                      | 152 kB  00:00:00     
    (15/32): krb5-libs-1.13.2-10.el7.x86_64.rpm                                                                     | 843 kB  00:00:00     
    (16/32): libpwquality-1.2.3-4.el7.x86_64.rpm                                                                    |  84 kB  00:00:00     
    (17/32): libuser-0.60-7.el7_1.x86_64.rpm                                                                        | 398 kB  00:00:00     
    (18/32): iproute-3.10.0-54.el7.x86_64.rpm                                                                       | 526 kB  00:00:00     
    (19/32): initscripts-9.49.39-1.el7_4.1.x86_64.rpm                                                               | 435 kB  00:00:00     
    (20/32): nss-3.28.4-15.el7_4.x86_64.rpm                                                                         | 849 kB  00:00:00     
    (21/32): libsemanage-2.5-8.el7.x86_64.rpm                                                                       | 145 kB  00:00:00     
    (22/32): openssl-libs-1.0.1e-42.el7.9.x86_64.rpm                                                                | 949 kB  00:00:00     
    (23/32): openldap-2.4.40-8.el7.x86_64.rpm                                                                       | 348 kB  00:00:00     
    (24/32): python-libs-2.7.5-34.el7.x86_64.rpm                                                                    | 5.6 MB  00:00:00     
    (25/32): pam-1.1.8-12.el7_1.1.x86_64.rpm                                                                        | 714 kB  00:00:00     
    (26/32): rpm-4.11.3-17.el7.x86_64.rpm                                                                           | 1.2 MB  00:00:00     
    (27/32): setup-2.8.71-6.el7.noarch.rpm                                                                          | 165 kB  00:00:00     
    (28/32): shadow-utils-4.1.5.1-18.el7.x86_64.rpm                                                                 | 1.1 MB  00:00:00     
    (29/32): util-linux-2.23.2-26.el7.x86_64.rpm                                                                    | 1.9 MB  00:00:00     
    (30/32): yum-3.4.3-132.el7.centos.0.1.noarch.rpm                                                                | 1.2 MB  00:00:00     
    (31/32): yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm                                                      |  30 kB  00:00:00     
    (32/32): systemd-219-42.el7_4.6.x86_64.rpm                                                                      | 5.2 MB  00:00:00     
    supermin: writing supermin.d.1tcmz1m8/base.tar.gz
    supermin: renaming supermin.d.1tcmz1m8 to supermin.d
    

    3 下面开始构建我们的镜像。下面命令是根据上一步准备的安装包目录制作隔离的环境,并保存在appliance.d目录下

    [root@server media]# 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: 135 packages, including dependencies
      supermin: build: 26059 files
      supermin: build: 12875 files, after removing unreadable files
      supermin: build: 12875 files, after matching excludefiles
      supermin: build: 12875 files, after adding hostfiles
      supermin: build: 12913 files, after munging
      supermin: renaming appliance.d.idqctht6 to appliance.d
    

    4 如果要使用yum安装软件包,可以执行我们的下面的命令

    [root@server media]# echo 7 > appliance.d/etc/yum/vars/releasever
    

    5 如果要上网,则要执行我们下面的命令

    [root@server media]#  cp /etc/resolv.conf appliance.d/etc/
    

    6 然后开始构建我们的镜像

    [root@server media]# tar  --numeric-owner -cpf centos-7.tar -C appliance.d/ .
    

    7 开始导入我们的容器

    [root@server media]# cat centos-7.tar | docker import - 10.0.3.137:5000/centos-8888
    sha256:d06398dcf03fc1d3ef0be50dc5759948775933adc177237644fb5510981c3990
    

    8 使用docker命令查看我们的容器

    root@server media]# docker images | grep  centos-8888
    10.0.3.137:5000/centos-8888               latest              d06398dcf03f        4 minutes ago       260.6 MB
    



    原文链接:https://blog.csdn.net/qq_28513801/java/article/details/90808962

    相关文章

      网友评论

          本文标题:supermin5构建镜像

          本文链接:https://www.haomeiwen.com/subject/dcaykktx.html