我的系统是 centos 6.5
执行命令安装docker : curl -sSL https://get.daocloud.io/docker | sh
然后 :使用docker help 可以正常查看
但是 docker info docker images
就都提示Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
我怀疑docker daemon 没有起来,于是 我用 service docker start 启动docker
结果:Starting docker: [ OK ]
但是 service docker status
结果: docker dead but pid file exists
现在看来,docker 绝对没有起来了,那怎么办?
查看docker 日志: vi /var/log/docker
结果日志显示:
/usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
\nMon Dec 5 02:48:53 PST 2016\n
time="2016-12-05T02:48:53.072777578-08:00" level=warning msg="You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0."
time="2016-12-05T02:48:53.075497872-08:00" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
提示内核版本太低,2.6不行,需要升级到3.10 。
怎么升级内核?
在yum的ELRepo源中,有 m ain l ine(3.13.1)、 l ong- t erm(3.10.28)这2个内核版本,考虑到long-term更稳定,会长期更新,所以选择这个版本。
1、导入public key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2、安装ELRepo到CentOS-6.5中
rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
3、安装 kernel-lt(lt=long-term)
yum --enablerepo=elrepo-kernel install kernel-lt -y
或者安装kernel-ml(ml=mainline)
yum --enablerepo=elrepo-kernel install kernel-ml -y
4、编辑grub.conf文件,修改Grub引导顺序
vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.28-1.el6.elrepo.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-3.10.28-1.el6.elrepo.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8
rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-3.10.28-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-431.3.1.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8 r
d_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-431.3.1.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO
_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-431.el6.x86_64.img
确认刚安装好的内核在哪个位置,然后设置default值 ,default 可以设置的值是0,1,2,3.。。。等序号,
代表的是当前系统中的内核的位置,一般新安装的内核应该是在第一位的,default 应该设置为0,
但是我实际测试 default 设置为1 才启动了新内核,很奇怪。
5、重启,查看内核版本号
[root@dev ~]# uname -r
3.10.28-1.el6.elrepo.x86_64
转自:http://www.tuicool.com/articles/rUvERv
然后在尝试启动,有报错了:symbol dm_task_get_info_with_deferred_remove, version Base not defined
解决办法: yum upgrade device-mapper-libs