用supermin制作centos 7 docker 基础镜像

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hjh00/article/details/72859287

supermin5 一个工具,运行命令man supermin可以查看关于这个工具的基本信息。

NAME
       supermin - Tool for creating supermin appliances

SYNOPSIS
        supermin [-o OUTPUTDIR] --names LIST OF PKGS ...
        supermin [-o OUTPUTDIR] PKG FILE NAMES ...

DESCRIPTION
       Supermin is a tool for building supermin appliances.  These are tiny appliances (similar to virtual machines), usually
       around 100KB in size, which get fully instantiated on-the-fly in a fraction of a second when you need to boot one of
       them.

       Originally "fe" in "febootstrap" stood for "Fedora", but this tool is now distro-independent and can build supermin
       appliances for several popular Linux distros, and adding support for others is reasonably easy.  For this reason,
       starting with version 4, we have renamed the tool "supermin".

       Note that this manual page documents supermin 4.x which is a complete rewrite and quite different from febootstrap 2.x.
       If you are looking for the febootstrap 2.x tools, then this is not the right place.
运行命令supermin5 --help可以查看基本的使用方法

[root@centos7 ~]# supermin5 --help
supermin - tool for creating supermin appliances
Copyright (C) 2009-2014 Red Hat Inc.

Usage:

  supermin --prepare LIST OF PACKAGES ...
  supermin --build INPUT [INPUT ...]

For full instructions, read the supermin(1) man page.

Options:

  --build                      Build a full appliance
  --copy-kernel                Copy kernel instead of symlinking
  --dtb WILDCARD               Find device tree matching wildcard
  -f chroot|ext2               Set output format
  --format                     -"-
  --host-cpu ARCH              Set host CPU architecture
  --if-newer                   Only build if needed
  --include-packagelist        Add a file with the list of packages
  --list-drivers               Display list of drivers and exit
  --lock LOCKFILE              Use a lock file
  --names                      Give an error for people needing supermin 4
  -o OUTPUTDIR                 Set output directory
  --packager-config CONFIGFILE Set packager config file
  --prepare                    Prepare a supermin appliance
  --size                       Set the size of the ext2 filesystem
  --use-installed              Use installed files instead of accessing network
  -v                           Enable debugging messages
  --verbose                    -"-
  -V                           Display version and exit
  --version                    -"-
  -help                        Display this list of options
  --help                       Display this list of options
如果找不到该命令,用 yum install supermin* 安装。

步骤-1

supermin5 -v --prepare bash coreutils -o supermin.d

步骤-2

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

步骤-3

echo 7.2 > appliance.d/etc/yum/vars/releasever
tar --numeric-owner -cpf centos-7-2.tar -C appliance.d .

步骤-4导入tar文件到docker

 cat centos-7-2.tar | docker import - oliver/centos:v7.2


制作镜像时想包含某个命令,但又不知道在哪个包时,可以用yum whatprovides 来查找。

[root@centos7 images]# yum whatprovides */ifconfig
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
源    :base
匹配来源:
文件名    :/sbin/ifconfig



net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
源    :installed
匹配来源:
文件名    :/sbin/ifconfig



猜你喜欢

转载自blog.csdn.net/hjh00/article/details/72859287