docker 几个错误的fix

SELinux安全系统和btrfs文件系统不和尝试启动docker service失败,使用systemctl查看提示如下:

# systemctl status docker.service -l
...
SELinux is not supported with the BTRFS graph driver!
...

这是因为目前btrfs的文件系统还不能用SELinux.网上有讨论在这儿,这儿和这儿.若不打算系统级别关掉SELinux的话(当然,我才不关呢),编辑/etc/sysconfig/docker文件,把OPTIONS=’–selinux-enabled’的–selinux-enabled注释掉,也可以通过这个错误.

# Modify these options if you want to change the way the docker daemon runs
#OPTIONS='--selinux-enabled'
OPTIONS=''

....

显示错误如下:

[graphdriver] using prior storage driver \"btrfs\"...

有类似讨论在此处.大致意思是在兼容以前的时候有些错误.

此外,我发现它在使用firewalld的时候好像不太正常.所以先编辑用回iptables. 又因为大约刚刚更新过的缘故,内核和最新的不太一致,因此先重启一个.

重启后,启动前,先删除(或者rename?) /var/lib/docker 目录. 然后启动就没有问题了.

启动成功查看状态如下:

# systemctl status docker.service -l
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: active (running) since Thu 2015-08-13 01:50:59 CST; 15min ago
Docs: http://docs.docker.com
Main PID: 11847 (docker)
CGroup: /system.slice/docker.service
└─11847 /usr/bin/docker -d

Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.422176241+08:00" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.424560239+08:00" level=info msg="[graphdriver] using prior storage driver \"btrfs\""
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.515303869+08:00" level=warning msg="Running modprobe bridge nf_nat br_netfilter failed with message: insmod /lib/modules/3.10.0-229.11.1.el7.x86_64/kernel/net/llc/llc.ko \ninsmod /lib/modules/3.10.0-229.11.1.el7.x86_64/kernel/net/802/stp.ko \ninsmod /lib/modules/3.10.0-229.11.1.el7.x86_64/kernel/net/bridge/bridge.ko \ninsmod /lib/modules/3.10.0-229.11.1.el7.x86_64/kernel/net/netfilter/nf_nat.ko \n, error: exit status 1"
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.519829889+08:00" level=info msg="Firewalld running: false"
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.789430357+08:00" level=info msg="Loading containers: start."
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.789643957+08:00" level=info msg="Loading containers: done."
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.789660312+08:00" level=info msg="Daemon has completed initialization"
Aug 13 01:50:59 yuik.argcv.com docker[11847]: time="2015-08-13T01:50:59.789678285+08:00" level=info msg="Docker daemon" commit="3043001/1.7.1" execdriver=native-0.2 graphdriver=btrfs version=1.7.1
Aug 13 01:50:59 yuik.argcv.com systemd[1]: Started Docker Application Container Engine.

可以注意到还有一个warning, 不过已经能用了. 先存此档,回头细究.

Docker —— 从入门到实践 这本书的确蛮不错的.