Centos6.5下docker 环境搭建

一.运行docker Linux内核版本需要在3.8以上,针对centos6.5 内核为2.6的系统需要先升级内核.不然会特别卡,退出容器.

在yum的ELRepo源中,有mainline(3.13.1)、long-term(3.10.28)这2个内核版本,考虑到long-term更稳定,会长期更新,所以选择这个版本。

1.查看当前版本:
[quote]# more /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux[/quote]

2.升级内核至3.10.28
[list]
[*]1.>导入public key
[quote]rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org[/quote]
[*]2.>安装ELRepo到CentOS-6.5中
[quote]rpm -ivh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm[/quote]
[*]3.>安装**kernel-lt(lt=long-term)**
[quote]yum --enablerepo=elrepo-kernel install kernel-lt -y[/quote]
或者安装kernel-ml(ml=mainline)
[quote]yum --enablerepo=elrepo-kernel install kernel-ml -y[/quote]
[*]4.>编辑grub.conf文件,修改Grub引导顺序
[quote]vim /etc/grub.conf

# grub.conf generated by anaconda
#
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.28-1.el6.elrepo.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-3.10.28-1.el6.elrepo.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-3.10.28-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-431.3.1.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-431.3.1.el6.x86_64.img[/quote]
确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0
[*]5.>重启,查看内核版本号.
[quote]# reboot
# uname -r
3.10.104-1.el6.elrepo.x86_64[/quote]
至此,CentOS6.5的内核升级完成,下面就可以安装docker了.
[/list]

[size=large][color=black][b]二.安装docker[/b][/color][/size]
直接使用命令: yum install docker-io 是会报错的!!! 提示:No package docker-io available.

需要先安装yum 源.
[quote]yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm[/quote]
再执行
[quote]yum install docker-io[/quote]
就可以正常安装了!!

在安装的过程中由于dns的问题报了错,所以要设置好自己的dns确保服务器能连接到外网,我当时设置的dns为:
[quote]vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4[/quote]
启动docker
[quote]service docker start[/quote]
查看docker版本:
[quote]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64[/quote]
查看docker日志
[quote]cat /var/log/docker[/quote]
至此,docker安装完成!!!

参考:[url]http://www.cnblogs.com/saneri/p/6178536.html[/url]

[color=red][b]docker官网[/b][/color]:[url]https://docs.docker.com/engine/installation/linux/centos/[/url]

[color=red][b]配置docker官方源并用yum安装docker[/b][/color]
[url]https://www.cnblogs.com/JiangLe/p/6921320.html[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值