使用supermin5 制作docker 镜像

安装supermin5-5.1.19-1.el7.aarch64

创建镜像:supermin5 -v --prepare base coreutils -o supermin.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: prepare: base coreutils
supermin: packages specified on the command line:
  - coreutils-8.22-24.el7.aarch64
supermin: writing supermin.d.ys8qm12h/packages
supermin: after resolving dependencies there are 41 packages:
  - basesystem-10.0-7.el7.centos.noarch
  - bash-4.2.46-33.el7.aarch64
  - ca-certificates-2019.2.32-76.el7_7.noarch
  - centos-release-7-7.1908.0.el7.centos.aarch64
  - chkconfig-1.7.4-1.el7.aarch64
  - coreutils-8.22-24.el7.aarch64
  - filesystem-3.2-25.el7.aarch64
  - gawk-4.0.2-4.el7_3.1.aarch64
  - glibc-2.17-292.el7.aarch64
  - glibc-common-2.17-292.el7.aarch64
  - gmp-1:6.0.0-15.el7.aarch64
  - grep-2.20-3.el7.aarch64
  - info-5.1-5.el7.aarch64
  - keyutils-libs-1.5.8-3.el7.aarch64
  - krb5-libs-1.15.1-37.el7_7.2.aarch64
  - libacl-2.2.51-14.el7.aarch64
  - libattr-2.4.46-13.el7.aarch64
  - libcap-2.22-10.el7.aarch64
  - libcom_err-1.42.9-16.el7.aarch64
  - libffi-3.0.13-18.el7.aarch64
  - libgcc-4.8.5-39.el7.aarch64
  - libselinux-2.5-14.1.el7.aarch64
  - libsepol-2.5-10.el7.aarch64
  - libstdc++-4.8.5-39.el7.aarch64
  - libtasn1-4.10-1.el7.aarch64
  - libverto-0.2.5-4.el7.aarch64
  - ncurses-5.9-14.20130511.el7_4.aarch64
  - ncurses-base-5.9-14.20130511.el7_4.noarch
  - ncurses-libs-5.9-14.20130511.el7_4.aarch64
  - nspr-4.21.0-1.el7.aarch64
  - nss-softokn-freebl-3.44.0-8.el7_7.aarch64
  - nss-util-3.44.0-4.el7_7.aarch64
  - openssl-libs-1:1.0.2k-19.el7.aarch64
  - p11-kit-0.23.5-3.el7.aarch64
  - p11-kit-trust-0.23.5-3.el7.aarch64
  - pcre-8.32-17.el7.aarch64
  - popt-1.13-16.el7.aarch64
  - sed-4.2.2-5.el7.aarch64
  - setup-2.8.71-10.el7.noarch
  - tzdata-2019c-1.el7.noarch
  - zlib-1.2.7-18.el7.aarch64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.xtom.com.hk
 * centos-sclo-rh: mirror.xtom.com.hk
 * epel: mirrors.njupt.edu.cn
 * extras: mirror.xtom.com.hk
 * updates: mirror.xtom.com.hk
(1/11): centos-release-7-7.1908.0.el7.centos.aarch64.rpm                                                                                      |  26 kB  00:00:00
(2/11): bash-4.2.46-33.el7.aarch64.rpm                                                                                                        | 984 kB  00:00:01
(3/11): grep-2.20-3.el7.aarch64.rpm                                                                                                           | 339 kB  00:00:00
(4/11): info-5.1-5.el7.aarch64.rpm                                                                                                            | 222 kB  00:00:00
(5/11): krb5-libs-1.15.1-37.el7_7.2.aarch64.rpm                                                                                               | 770 kB  00:00:00
(6/11): openssl-libs-1.0.2k-19.el7.aarch64.rpm                                                                                                | 951 kB  00:00:00
(7/11): setup-2.8.71-10.el7.noarch.rpm                                                                                                        | 166 kB  00:00:00
(8/11): ca-certificates-2019.2.32-76.el7_7.noarch.rpm                                                                                         | 399 kB  00:00:05
(9/11): glibc-2.17-292.el7.aarch64.rpm                                                                                                        | 3.6 MB  00:00:07
(10/11): glibc-common-2.17-292.el7.aarch64.rpm                                                                                                |  12 MB  00:00:25
(11/11): coreutils-8.22-24.el7.aarch64.rpm                          85% [=================================================-        ]  800 B/s |  19 MB  01:08:38 ETA
coreutils-8.22-24.el7.aarch64. FAILED                                          ===========================================-        ]  1.6 B/s |  19 MB 552:30:13 ETA
http://centosx4.centos.org/altarch/7.7.1908/os/aarch64/Packages/coreutils-8.22-24.el7.aarch64.rpm: [Errno 12] Timeout on http://centosx4.centos.org/altarch/7.7.1908/os/aarch64/Packages/coreutils-8.22-24.el7.aarch64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(11/11): coreutils-8.22-24.el7.aarch64.rpm                                                                                                    | 3.3 MB  00:00:02
supermin: there are 60 config files
supermin: writing supermin.d.ys8qm12h/base.tar.gz
./etc/issue
./etc/issue.net
./etc/os-release
./etc/system-release-cpe
./etc/yum.repos.d/CentOS-Base.repo
./etc/yum.repos.d/CentOS-CR.repo
./etc/yum.repos.d/CentOS-Debuginfo.repo
./etc/yum.repos.d/CentOS-Media.repo
./etc/yum.repos.d/CentOS-Sources.repo
./etc/yum.repos.d/CentOS-Vault.repo
./etc/yum.repos.d/CentOS-fasttrack.repo
./etc/yum/vars/contentdir
./etc/yum/vars/infra
./etc/aliases
./etc/bashrc
./etc/csh.cshrc
./etc/csh.login
./etc/environment
./etc/exports
./etc/filesystems
./etc/group
./etc/gshadow
./etc/host.conf
./etc/hosts
./etc/hosts.allow
./etc/hosts.deny
./etc/inputrc
./etc/motd
./etc/passwd
./etc/printcap
./etc/profile
./etc/profile.d/csh.local
./etc/profile.d/sh.local
./etc/protocols
./etc/securetty
./etc/services
./etc/shadow
./etc/shells
./etc/subgid
./etc/subuid
./etc/krb5.conf
./etc/pki/ca-trust/ca-legacy.conf
./etc/default/nss
./etc/pki/tls/openssl.cnf
./etc/ld.so.conf
./etc/nsswitch.conf
./etc/rpc
./usr/lib64/gconv/gconv-modules
./etc/GREP_COLORS
./etc/profile.d/colorgrep.csh
./etc/profile.d/colorgrep.sh
./usr/share/info/dir
./etc/skel/.bash_logout
./etc/skel/.bash_profile
./etc/skel/.bashrc
./etc/DIR_COLORS
./etc/DIR_COLORS.256color
./etc/DIR_COLORS.lightbgcolor
./etc/profile.d/colorls.csh
./etc/profile.d/colorls.sh
supermin: renaming supermin.d.ys8qm12h to supermin.d

构建一个完全supermin5 需要的工具
[root@k8s-node2 ~]# supermin5 -v --build --format chroot supermin.d -o applicance.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: build: supermin.d
supermin: reading the supermin appliance
supermin: build: visiting supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting supermin.d/packages type uncompressed packages
supermin: mapping package names to installed packages
BDB2053 Freeing read locks for locker 0x630: 27705/281473722142944
BDB2053 Freeing read locks for locker 0x632: 27705/281473722142944
BDB2053 Freeing read locks for locker 0x633: 27705/281473722142944
BDB2053 Freeing read locks for locker 0x634: 27705/281473722142944
supermin: resolving full list of package dependencies
supermin: build: 41 packages, including dependencies
supermin: build: 18627 files
supermin: build: 18627 files, after matching excludefiles
supermin: build: 18627 files, after adding hostfiles
supermin: build: 5456 files, after removing unreadable files
supermin: build: 5485 files, after munging
supermin: renaming applicance.d.s4mxf5lk to applicance.d

设置版本号
[root@k8s-node2 ~]# echo 7.4 > applicance.d/etc/yum/vars/releasever

打包文件到docker镜像
[root@k8s-node2 ~]# tar --numeric-owner -cpf centos74.tar -C applicance.d .
 导入镜像
[root@k8s-node2 ~]# cat centos74.tar | docker import - centos74
sha256:b31cbb487592bc4d98521612bc8986fc4e115ea91f35a85a8205d2be93418820

查看镜像
[root@k8s-node2 ~]# docker images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED              SIZE
centos74                                                         latest              b31cbb487592        About a minute ago   102 MB

运行

[root@k8s-node2 ~]docker run -it centos74 /bin/bash
bash-4.2# uname -a
Linux 1f0a4a82483f 4.14.0-115.el7a.0.1.aarch64 #1 SMP Sun Nov 25 20:54:21 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
bash-4.2#


发布了1447 篇原创文章 · 获赞 71 · 访问量 144万+

猜你喜欢

转载自blog.csdn.net/tiantao2012/article/details/105736017
今日推荐