centos 6.5下安装docker

时间:2023-03-09 08:33:35
centos 6.5下安装docker

关于docker的更多信息,请移步度娘。以下两个链接也对docker有了具体的介绍:

http://www.docker.org.cn/book/docker/what-is-docker-16.html

http://udn.yyuap.com/doc/docker_practice/image/list.html

本篇仅仅用于记下自己在centos6.5环境下安装docker的过程。

一.升级内核

1.检查并升级内核

uname -r

centos6.5默认内核版本为2.6,而docker官方文档要求内核要在3.8以上,并且只能运行于64位系统。故需升级内核版本(此处为带aufs模块):

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值将升级的内核作为默认启动的kernel。

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=c243bf98-2ece-41a4-b660-b11e8d786fcb 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=c243bf98-2ece-41a4-b660-b11e8d786fcb 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.重启系统后查看内核是否正确启动。

[root@localhost ~]# uname -r
3.10.5-3.el6.x86_64

4.查看内核支持aufs

[root@localhost ~]# grep aufs /proc/filesystems
nodev    aufs

二.安装Docker

1.关闭selinux

setenforce 0
sed -i '/^SELINUX=/c\SELINUX=disabled' /etc/selinux/config

2.下载安装epel

wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
sed -i 's/^mirrorlist=https/mirrorlist=http/' /etc/yum.repos.d/epel.repo

3.安装docker-io:

yum -y install docker-io

4.启动docker:

service docker start

5.查看docker版本:

docker version

此时,docker安装完成。关于docker的命令及介绍,移步:

http://www.docker.org.cn/book/docker/what-is-docker-16.html

http://udn.yyuap.com/doc/docker_practice/image/list.html