标签:style blog http color os io art div
在https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F 中选择自己的epel源.
接着,安装docker-io:
$ sudo yum install docker-io
启动Docker daemon:
$ sudo service docker start
将Docker设置成开机启动:
$ sudo chkconfig docker on
下载最新的基础centos:
$ sudo docker pull centos:latest
测试centos是否可以运行成功:
$ sudo docker images centos
注册自己的Docker仓库帐号,作用相当于开辟一个image仓库,等同于GitHub:
https://hub.docker.com/account/signup/
下面举个例子,我在image:centos中安装wget后,提交到自己的repository:
进入操作界面
[root@113058 ~]# sudo docker run -i -t centos /bin/bash bash-4.2#
安装wget,安装结束后退出:
bash-4.2# yum install wget bash-4.2#exit
查看自己的修改记录:
[root@113058 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5f962b864221 centos:latest /bin/bash 2 minutes ago Exited (0) 42 seconds ago goofy_mcclintock 36f07f440c17 centos:latest /bin/bash 38 minutes ago Exited (0) 35 minutes ago boring_kowalevski 38e000fbee87 centos:latest /bin/bash 41 minutes ago Exited (127) 40 minutes ago sleepy_yonath
可以看到,最近提交的是5f962b864221,这个即是我们安装了wget的image,将它push到自己的repository,有三个步骤:
[root@113058 ~]# docker commit 5f962b864221 alexknight/centos-wget
其中,alexknight是自己在仓库里开辟的空间名,接下来是登录自己的帐号
[root@113058 ~]# docker login -u "第二步注册的名字" -p "passwd" -e "邮箱地址"
登录成功后,push自己的提交
[root@113058 ~]# docker push alexknight/centos-wget
当在界面看到centos-wget时,操作成功。
把自己提交的centos-wget下载:
[root@113058 ~]# docker pull alexknight/centos-wget Pulling repository alexknight/centos-wget aa194d98cc9e: Download complete 511136ea3c5a: Download complete 34e94e67e63a: Download complete 1a7dc42f78ba: Download complete
再次进入到自己的centos-wget这个版本进行持续提交时:
[root@113058 ~]#sudo docker run -i -t alexknight/centos-wget /bin/bash
Docker简明教程(以安装wget程序为例),布布扣,bubuko.com
标签:style blog http color os io art div
原文地址:http://www.cnblogs.com/alexkn/p/3875937.html