7、重启系统,选择“3.10.5-3.el6.x86_64”内核
8、系统启动后,确认当前运行的内核
[root@localhost ~]# uname -r 3.10.5-3.el6.x86_64 [root@localhost ~]# grep aufs /proc/filesystems nodev aufs
9、以守护模式运行docker.io(在一个新的终端里)
[root@localhost ~]# docker -d 2013/08/21 07:47:07 WARNING: Your kernel does not support cgroup swap limit. 2013/08/21 07:47:07 Listening for HTTP on /var/run/docker.sock (unix)
10、在CentOS6.4容器里输出hello world
[root@localhost ~]# docker run centos:6.4 echo "hello world" 2013/08/21 07:48:41 POST /v1.4/containers/create 2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/start 2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/attach?logs=1&stderr=1&stdout=1&stream=1 hello world
11、从容器里测试ping
[root@localhost ~]# docker -dns '8.8.8.8' run centos:6.4 ping -c 3 yahoo.com 2013/08/21 08:02:15 POST /v1.4/containers/create 2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/start 2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/attach?logs=1&stderr=1&stdout=1&stream=1 PING yahoo.com (98.138.253.109) 56(84) bytes of data. 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=1 ttl=48 time=323 ms 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=2 ttl=48 time=329 ms 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=3 ttl=49 time=302 ms --- yahoo.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2304ms rtt min/avg/max/mdev = 302.032/318.318/329.656/11.807 ms
常见错误:
"DNS/Networking Errors inside the docker"
[root@localhost ~]# docker -dns="8.8.8.8" run centos:6.4 yum install hiphop-php 2013/08/21 07:53:05 POST /v1.4/containers/create 2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/start 2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/attach?logs=1&stderr=1&stdout=1&stream=1 Loaded plugins: fastestmirror Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
可以执行下面的命令来重置docker的运行环境,从而解决上述问题。
pkill docker iptables -t nat -F ifconfig docker0 down brctl delbr docker0 docker -d
感谢sciurus在创建kernel-ml-aufs的相关文件时付出的辛勤工作。
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
