CentOS6安装docker
1、升级内核到3.10
cd /etc/yum.repos.d wget http://www.hop5.in/yum/el6/hop5.repo yum install kernel-ml-aufs kernel-ml-aufs-devel
2、修改grub的主配置文件/etc/grub.conf,设置default=0,表示第一个title下的内容为默认启动的kernel(一般新安装的内核在第一个位置),修改之后如下:
[root@localhost ~]# cat /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 (3.10.5-3.el6.x86_64) root (hd0,0) kernel /vmlinuz-3.10.5-3.el6.x86_64 ro root=UUID=78514585-1521-472c-8ca4-110fb82e9959 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet initrd /initramfs-3.10.5-3.el6.x86_64.img title CentOS (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=78514585-1521-472c-8ca4-110fb82e9959 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-431.el6.x86_64.img
3、重启系统,这时候你的内核就成功升级了,执行uname -r
[root@localhost ~]# uname -r 3.10.5-3.el6.x86_64
4、确保系统中yum下载的包是最新的
sudo yum update
5、创建docker的yum源
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
6、安装docker
sudo yum install docker-engine
7、启动docker
sudo service docker start
8、查看docker服务状态
service docker status
如果显示 docker dead but pid file exists,则执行如下指令
sudo yum-config-manager --enable public_ol6_latest sudo yum install device-mapper-event-libs
9、再查看docker的服务状态
[root@localhost ~]# service docker status docker (pid 2581) is running...