docker只能启动busybox,不能启动高级容器,CentOS6升级内核

1. 可以启动busybox,后台启动高级容器直接退出,启动时进入容器提示:FATAL: kernel too old

[root@l ~]# docker run -it centos
FATAL: kernel too old

2. 查看内核:

[root@l ~]# uname -r
2.6.32-696.el6.x86_64

3. 导入public key

[root@l ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

4. 安装ELRepo:

[root@l ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm

5. 升级Kernel(在 ELRepo 中有两个内核选项,一个是 kernel-lt(长期支持版本),一个是 kernel-ml(主线最新版本))

# kernel-lt 当然要选这个
yum --enablerepo=elrepo-kernel install kernel-lt -y 
or
# kernel-ml
yum --enablerepo=elrepo-kernel install kernel-ml -y 

6. 修改启动项vim /etc/grub.conf

[root@CQ-TX-01-01 ~]# 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 have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (4.4.199-1.el6.elrepo.x86_64)
        root (hd0,0)
        kernel /vmlinuz-4.4.199-1.el6.elrepo.x86_64 ro root=UUID=ca8b48f9-0f24-4604-b2a5-e97b4b8c7f3a rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD  KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet rhgb quiet
        initrd /initramfs-4.4.199-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-754.23.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-754.23.1.el6.x86_64 ro root=UUID=ca8b48f9-0f24-4604-b2a5-e97b4b8c7f3a rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD  KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet rhgb quiet
        initrd /initramfs-2.6.32-754.23.1.el6.x86_64.img
title CentOS 6 (2.6.32-696.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=UUID=ca8b48f9-0f24-4604-b2a5-e97b4b8c7f3a rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD  KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet rhgb quiet
        initrd /initramfs-2.6.32-696.el6.x86_64.img

7. reboot重启

8. 再次查看内核:

[root@l ~]# uname -r
4.4.199-1.el6.elrepo.x86_64

9. 内核升级成功,再次运行容器成功

[root@l ~]# docker run -p 27017:27017 -v /mnt/mongo/db:/data/db --name docker_mongodb -d mongo --auth
92ab1d0c127801fada8586cf1cf2b3c42728eea253e0ec860011cae2373184cb
[root@l ~]# docker exec -it 92 bash
root@92ab1d0c1278:/# mongo
。。。。。。。。。。。。。。。。。。。。。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章