Docker - Image创建

自己创建Image会有一些好处,可以选择最新的版本,而且从国内的镜像创建时更新软件也会从该镜像获取,速度更快。

(1)安装debootstrap

zhouh1@uhome:/media/zhouh1/databak/docker$ sudo apt-get install debootstrap 
Reading package lists... Done
。。。。。。。

以下为关于这个包的介绍

Description: Bootstrap a basic Debian system
 debootstrap is used to create a Debian base system from scratch, without requiring the availability of dpkg or apt. It does this by downloading .deb files from a mirror site,
 and carefully unpacking them into a directory which can eventually be chrooted into.

 

(2)创建基础系统

zhouh1@uhome:/mnt/data/docker$ sudo debootstrap trusty trusty http://mirrors.163.com/ubuntu/
I: Retrieving Release 
I: Retrieving Release.gpg 
I: Checking Release signature
I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages 
。。。。。。。。。。
。。。。。。。。。。
I: Configuring rsyslog...
I: Configuring kbd...
I: Configuring ubuntu-minimal...
I: Configuring libc-bin...
I: Configuring initramfs-tools...
I: Base system installed successfully

(3)导入到docker

zhouh1@uhome:/mnt/data/docker/trusty$  sudo tar -c . | sudo docker import - trusty
b769d49299800c7984036f3afdd73aa8f0f8f8d6bd8dd0c45c267ecabd04cb08

(4)测试

zhouh1@uhome:/mnt/data/docker/trusty$ sudo docker run -i -t trusty /bin/bash
root@2d66c560066c:/# test
root@2d66c560066c:/# echo

root@2d66c560066c:/# exit

 

posted @ 2014-08-16 21:13  utopiazh  阅读(669)  评论(0编辑  收藏  举报