這種制作方法很簡單,三步
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 ~]#