使用supermin製做CentOS的Docker鏡像

使用supermin製做CentOS的Docker鏡像

2016年09月21日 11:30:29docker

閱讀數:4199centos

使用supermin製做CentOS的Docker鏡像

在CentOS7上安裝supermin

$ sudo yum install -y supermin*
  • 1

建立鏡像 (如下命令須要使用root運行)

# supermin5 -v --prepare bash coreutils -o supermin.d
# supermin5 -v --build --format chroot supermin.d -o appliance.d
# echo 7 > appliance.d/etc/yum/vars/releasever

# tar --numeric-owner -cpf centos-7.tar -C appliance.d .
# cat centos-7.tar | docker import - kongxx/centos-7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

查看鏡像

$ sudo docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED              SIZE
kongxx/centos-7               latest              8c8f006aac6b        About a minute ago   167 MB
...
  • 1
  • 2
  • 3
  • 4

運行容器

$ sudo docker run -i -t kongxx/centos-7 /bin/bash

bash-4.2# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
  • 1
  • 2
  • 3
  • 4

轉載請以連接形式標明本文連接 
本文連接:http://blog.csdn.net/kongxx/article/details/52606041bash

相關文章
相關標籤/搜索