博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos6.5下docker 环境搭建
阅读量:6909 次
发布时间:2019-06-27

本文共 2528 字,大约阅读时间需要 8 分钟。

 

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

 

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

 

1、查看当前版本:

 
[root@localhost ~]# more /etc/issueCentOS release 6.5 (Final)Kernel \r on an \m[root@localhost ~]# uname -aLinux 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
 

2、升级内核至3.10.28

 

1、>导入public key

 
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
 

2、>安装ELRepo到CentOS-6.5中

 
rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
 

3、>安装**kernel-lt(lt=long-term)**

 
yum --enablerepo=elrepo-kernel install kernel-lt -y
 

或者安装kernel-ml(ml=mainline)

 
yum --enablerepo=elrepo-kernel install kernel-ml -y
 

4、>编辑grub.conf文件,修改Grub引导顺序

[root@localhost ~]# 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

 

确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0

 

5、>重启,查看内核版本号.

 
[root@localhost ~]# reboot[root@localhost ~]# uname -r3.10.104-1.el6.elrepo.x86_64
 

至此,CentOS6.5的内核升级完成,下面就可以安装docker了.

 

二、安装docker

 

 直接使用命令: yum install docker-io   是会报错的!!!  提示:No package docker-io available.

 

 需要先安装yum 源.

 
yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 

再执行

 
yum install docker-io
 

就可以正常安装了!!

 

在安装的过程中由于dns的问题报了错,所以要设置好自己的dns确保服务器能连接到外网,我当时设置的dns为:

 
vim /etc/resolv.conf nameserver 8.8.8.8nameserver 8.8.4.4
 

启动docker

 
service docker start
 

查看docker版本:

 
[root@localhost ]# docker versionClient version: 1.7.1Client API version: 1.19Go version (client): go1.4.2Git commit (client): 786b29d/1.7.1OS/Arch (client): linux/amd64Server version: 1.7.1Server API version: 1.19Go version (server): go1.4.2Git commit (server): 786b29d/1.7.1OS/Arch (server): linux/amd64
 

查看docker日志.

 
cat /var/log/docker
 

 至此,docker安装完成!!!

 

转载于:https://www.cnblogs.com/li1204008978/p/6780763.html

你可能感兴趣的文章
POJ3177 Redundant Paths【双连通分量】
查看>>
El表达式的用法个人总结
查看>>
object - c 语言基础 进阶笔记 随笔笔记
查看>>
iOS开发之--一些有用的博文和博客
查看>>
jmeter JDBC Request (查询数据库获取数据库数据) 的使用
查看>>
深入理解ajax系列第七篇——传递JSON
查看>>
Vim简明学习
查看>>
16.文件file
查看>>
PHP-FPM@year12
查看>>
Reportviewer中的函数使用——打印当前日期并格式化
查看>>
oracle用户管理
查看>>
15.Intellij中配置jdk/tomcat/maven
查看>>
GridView中实现CheckBox的全选
查看>>
home.pl 正在促销,一些域名免费(终止于2017.4.4)
查看>>
python、js 时间日期模块time
查看>>
Loadrunner监控Centos
查看>>
转:问题解决:The project cannot be built until build path errors are resolved
查看>>
Python--day25--面向对象之多态
查看>>
submit
查看>>
数据结构-----树状数组
查看>>