这种制作方法很简单,三步
1. 用安装盘安装一个操作系统,这里用的是CentOS-6.7-x86_64-minimal.iso在虚拟机下安装。
2.用tar命令将安装好后的操作系统转换成一个tar文件。
tar --numeric-owner --exclude=/proc --exclude=/sys -cvf centos6-base.tar /
3.在一台可运行docker的机器上用docker import命令转换成docker image
cat centos6-base.tar | docker import - centos6-base
运行验证
[root@cloud-1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos6-base latest c4c7d099ff2f 3 hours ago 544.6 MB
[root@cloud-1 ~]#
[root@cloud-1 ~]# docker run -i -t centos6-base cat /etc/redhat-release
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
CentOS release 6.7 (Final)
[root@cloud-1 ~]#