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
。。。。。。。。。。。。。。。。。。。。。