在升级过内核的机器上安装docker遇到的一个错误
在升级过内核的机器上安装docker遇到的一个错误
壬癸甲乙 发表于3年前
在升级过内核的机器上安装docker遇到的一个错误
  • 发表于 3年前
  • 阅读 581
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

在升级到kernel-3.17的centos-6.5上安装docker,直接执行以下命令:

yum install golang
yum install docker-io
chkconfig add docker
service docker start
但出现了以下错误:
[root@osd2 ~]# service docker start
Starting cgconfig service: Error: cannot mount memory to /cgroup/memory: No such file or directory
/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Failed to parse /etc/cgconfig.conf                         [FAILED]
Starting docker:	                                   [  OK  ]
[root@osd2 ~]# service docker start
[root@osd2 ~]# service docker status
docker dead but pid file exists
查了一下cgconfig:
[root@osd2 ~]#  /etc/init.d/cgconfig status
Stopped
[root@osd2 ~]# /etc/init.d/cgconfig start
Starting cgconfig service: Error: cannot mount memory to /cgroup/memory: No such file or directory
/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Failed to parse /etc/cgconfig.conf                         [FAILED]
[root@osd2 ~]# ls /cgroup/
blkio  devices  freezer  memory  net_cls
memory是有的,但就是出错,需要修改:
[root@osd2 ~]# cat /etc/cgconfig.conf
#
#  Copyright IBM Corporation. 2007
#
#  Authors:	Balbir Singh <balbir@linux.vnet.ibm.com>
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of version 2.1 of the GNU Lesser General Public License
#  as published by the Free Software Foundation.
#
#  This program is distributed in the hope that it would be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See man cgconfig.conf for further details.
#
# By default, mount all controllers to /cgroup/<controller>

mount {
	cpuset	= /cgroup/cpuset;
	cpu	= /cgroup/cpu;
	cpuacct	= /cgroup/cpuacct;
#	memory	= /cgroup/memory;
	devices	= /cgroup/devices;
	freezer	= /cgroup/freezer;
	net_cls	= /cgroup/net_cls;
	blkio	= /cgroup/blkio;
}
再次启动cgconfig,一切正常。但重启docker,依然报错:
[root@osd2 ~]# service docker status
docker dead but pid file exists

[root@osd2 ~]# tailf /var/log/docker 
\nMon Jan  5 14:04:33 CST 2015\n
2015/01/05 14:04:33 docker daemon: 1.3.2 39fa2fa/1.3.2; execdriver: native; graphdriver: 
[910cf963] +job serveapi(unix:///var/run/docker.sock)
[910cf963] +job init_networkdriver()
[info] Listening for HTTP on unix (/var/run/docker.sock)
Unable to enable network bridge NAT: iptables failed: iptables -I POSTROUTING -t nat -s 172.17.42.1/16 ! -o docker0 -j MASQUERADE: iptables v1.4.7: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)
[910cf963] -job init_networkdriver() = ERR (1)
2015/01/05 14:04:33  (exit status 3)
日志显示无法创建nat网桥,看了一下正常的docker环境和modules:
[root@lm backup]# lsmod | grep nat
ebtable_nat             2009  0 
ebtables               18135  1 ebtable_nat
iptable_nat             6051  1 
nf_nat                 23316  2 ipt_MASQUERADE,iptable_nat
nf_conntrack_ipv4       9506  4 iptable_nat,nf_nat
nf_conntrack           80390  6 xt_conntrack,xt_state,ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4
ip_tables              17831  3 iptable_nat,iptable_mangle,iptable_filter

[root@lm backup]# find /lib/modules/2.6.32-504.1.3.el6.x86_64/ -name "*nat*"
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_proto_dccp.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_proto_udplite.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_ftp.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_proto_sctp.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_proto_gre.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_sip.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_tftp.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_pptp.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/iptable_nat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_snmp_basic.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_amanda.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_h323.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat_irc.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/bridge/netfilter/ebt_snat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/bridge/netfilter/ebt_dnat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/bridge/netfilter/ebtable_nat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/net/sched/act_nat.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/drivers/net/natsemi.ko
/lib/modules/2.6.32-504.1.3.el6.x86_64/kernel/drivers/net/phy/national.ko
编译过内核的环境:
[root@osd2 /]# lsmod | grep nat
ebtable_nat             2071  0 
ebtables               26518  1 ebtable_nat

[root@osd2 modprobe.d]# find /lib/modules/3.17.4/ -name "*nat*"
/lib/modules/3.17.4/kernel/net/sched/act_nat.ko
/lib/modules/3.17.4/kernel/net/bridge/netfilter/ebt_snat.ko
/lib/modules/3.17.4/kernel/net/bridge/netfilter/ebt_dnat.ko
/lib/modules/3.17.4/kernel/net/bridge/netfilter/ebtable_nat.ko
/lib/modules/3.17.4/kernel/drivers/net/ethernet/natsemi
/lib/modules/3.17.4/kernel/drivers/net/ethernet/natsemi/natsemi.ko
/lib/modules/3.17.4/kernel/drivers/net/phy/national.ko

缺少了nat模块,才引起了上述错误,需要重新编译内核或使用旧内核。

共有 人打赏支持
粉丝 148
博文 184
码字总数 241281
×
壬癸甲乙
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: