用supermin制作centos 7 docker 基础镜像

本文介绍如何使用Supermin5工具创建CentOS7的基础Docker镜像,包括具体步骤与命令行操作指导。适用于希望了解并实践Docker镜像制作流程的技术人员。

用supermin制作centos 7 docker 基础镜像

2017年06月04日 16:07:32

阅读数:3164

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

 

 
  1. NAME

  2. supermin - Tool for creating supermin appliances

  3.  
  4. SYNOPSIS

  5. supermin [-o OUTPUTDIR] --names LIST OF PKGS ...

  6. supermin [-o OUTPUTDIR] PKG FILE NAMES ...

  7.  
  8. DESCRIPTION

  9. Supermin is a tool for building supermin appliances. These are tiny appliances (similar to virtual machines), usually

  10. around 100KB in size, which get fully instantiated on-the-fly in a fraction of a second when you need to boot one of

  11. them.

  12.  
  13. Originally "fe" in "febootstrap" stood for "Fedora", but this tool is now distro-independent and can build supermin

  14. appliances for several popular Linux distros, and adding support for others is reasonably easy. For this reason,

  15. starting with version 4, we have renamed the tool "supermin".

  16.  
  17. Note that this manual page documents supermin 4.x which is a complete rewrite and quite different from febootstrap 2.x.

  18. If you are looking for the febootstrap 2.x tools, then this is not the right place.

运行命令supermin5 --help可以查看基本的使用方法

 

 

 
  1. [root@centos7 ~]# supermin5 --help

  2. supermin - tool for creating supermin appliances

  3. Copyright (C) 2009-2014 Red Hat Inc.

  4.  
  5. Usage:

  6.  
  7. supermin --prepare LIST OF PACKAGES ...

  8. supermin --build INPUT [INPUT ...]

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

  11.  
  12. Options:

  13.  
  14. --build Build a full appliance

  15. --copy-kernel Copy kernel instead of symlinking

  16. --dtb WILDCARD Find device tree matching wildcard

  17. -f chroot|ext2 Set output format

  18. --format -"-

  19. --host-cpu ARCH Set host CPU architecture

  20. --if-newer Only build if needed

  21. --include-packagelist Add a file with the list of packages

  22. --list-drivers Display list of drivers and exit

  23. --lock LOCKFILE Use a lock file

  24. --names Give an error for people needing supermin 4

  25. -o OUTPUTDIR Set output directory

  26. --packager-config CONFIGFILE Set packager config file

  27. --prepare Prepare a supermin appliance

  28. --size Set the size of the ext2 filesystem

  29. --use-installed Use installed files instead of accessing network

  30. -v Enable debugging messages

  31. --verbose -"-

  32. -V Display version and exit

  33. --version -"-

  34. -help Display this list of options

  35. --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

 

 

 
  1. echo 7.2 > appliance.d/etc/yum/vars/releasever

  2. 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 来查找。

 

 
  1. [root@centos7 images]# yum whatprovides */ifconfig

  2. 已加载插件:fastestmirror

  3. Loading mirror speeds from cached hostfile

  4. * base: centos.ustc.edu.cn

  5. * extras: mirrors.cn99.com

  6. * updates: mirrors.cn99.com

  7. net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools

  8. 源 :base

  9. 匹配来源:

  10. 文件名 :/sbin/ifconfig

  11.  
  12.  
  13.  
  14. net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools

  15. 源 :installed

  16. 匹配来源:

  17. 文件名 :/sbin/ifconfig


 

 

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

文章标签: docker基础镜像supermin5docker

转载于:https://my.oschina.net/u/3367404/blog/1930844

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值