Docker安装及centos内核升级

1.安装docker

[root@gmdai ~]# sudo yum installhttp://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm

[root@gmdai ~]# sudo yum install docker-io

[root@gmdai ~]# service docker start

[root@gmdai ~]# chkconfig docker on

[root@gmdai ~]# yum install git -y

2.内核版本太低升级内核

[root@gmdai ~]# docker pulldaocloud.io/library/nginx:1.9.9   //pull镜像时报错让执行docker -d

Cannot connect to the Docker daemon. Is 'docker-d' running on this host?

[root@gmdai ~]# docker -d

WARN[0000] You are running linux kernel version2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgradeyour kernel to 3.10.0.               //提示内核版本号太低

INFO[0000] Listening for HTTP on unix(/var/run/docker.sock)

3.升级内核

rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm

yum --enablerepo=elrepo-kernelinstallkernel-ml -y

 

4.编辑grub.conf文件,修改Grub引导顺序

 

vim /etc/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub aftermaking 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)/grub/splash.xpm.gz

hiddenmenu

title CentOS (4.4.0-1.el6.elrepo.x86_64)

        root (hd0,0)

       kernel /vmlinuz-4.4.0-1.el6.elrepo.x86_64 ro root=/dev/mapper/vg_gmdai-lv_rootrd_NO_LUKS rd_LVM_LV=vg_gmdai/lv_swap rd_NO_MD rd_LVM_LV=vg_gmdai/lv_rootcrashkernel=auto.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet

       initrd /initramfs-4.4.0-1.el6.elrepo.x86_64.img

title CentOS (2.6.32-431.el6.x86_64)

       root (hd0,0)

       kernel /vmlinuz-2.6.32-431.el6.x86_64 roroot=/dev/mapper/vg_gmdai-lv_root rd_NO_LUKS rd_LVM_LV=vg_gmdai/lv_swap rd_NO_MDrd_LVM_LV=vg_gmdai/lv_root crashkernel=auto.UTF-8  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgbquiet

       initrd /initramfs-2.6.32-431.el6.x86_64.img

确认刚安装好的内核在哪个位置然后设置default0开始),一般新安装的内核在第一个位置所以设置default=0

 

5、重启,查看内核版本号

[root@gmdai ~]# uname -r

4.4.0-1.el6.elrepo.x86_64