-------------------------
[root@iZ28rg9439eZ ~]# brctl addbr mydockerbridge
[root@iZ28rg9439eZ ~]# ip addr add 192.168.1.1/24 dev mydockerbridge
为了查看是否成功添加mydockerbridge
[code=text]bridge name bridge id STP enabled interfaces
mydockerbridge 8000.000000000000 no
[root@iZ28rg9439eZ ~]# ip link set dev mydockerbridge up
[root@iZ28rg9439eZ ~]# docker -d -b mydockerbridge
2014/08/19 09:53:10 WARNING: You are running linux kernel version 2.6.32-431.23.3.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
2014/08/19 09:53:10 docker daemon: 1.0.0 63fe64c/1.0.0; execdriver: native; graphdriver:
[608c086e] +job initserver()
[608c086e.initserver()] Creating server
[608c086e] +job serveapi(unix:///var/run/docker.sock)
2014/08/19 09:53:10 Listening for HTTP on unix (/var/run/docker.sock)
[608c086e] +job init_networkdriver()
[608c086e] -job init_networkdriver() = OK (0)
Loading containers: : done.
[608c086e.initserver()] Creating pidfile
[608c086e.initserver()] Setting up signal traps
[608c086e] -job initserver() = OK (0)
[608c086e] +job acceptconnections()
[608c086e] -job acceptconnections() = OK (0)
这时候,你需要打开另一个command窗口,或者你让上面的进程永久执行,但我这里暂不需要,所以另开一个:
[root@iZ28rg9439eZ ~]# sudo service docker start
Starting docker: [ OK ]
[root@iZ28rg9439eZ ~]# sudo chkconfig docker on
[root@iZ28rg9439eZ ~]# sudo docker pull centos:latest
[root@iZ28rg9439eZ ~]# sudo docker pull centos:latest
Pulling repository centos
b157b77b1a65: Download complete 511136ea3c5a: Download complete
34e94e67e63a: Download complete
[root@iZ28rg9439eZ ~]# sudo docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest b157b77b1a65 2 weeks ago 243.7 MB
成功down下了centos
[root@iZ28rg9439eZ ~]# sudo docker run -i -t centos /bin/bash
bash-4.2# ls
bin etc lib lost+found mnt proc run selinux sys usr
dev home lib64 media opt root sbin srv tmp var
bash-4.2# pwd
/
bash-4.2# exit
exit
[root@iZ28rg9439eZ ~]#
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。