一、配置redhat 6.5的yum源(使用centos的yum)
1. 创建一个临时存放rpm包的目录:
mkdir /home/users/yumtmp
cd /home/users/yumtmp
2. 下载对应的yum包
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
(如果发现下载包不存在,可能是升级了,请到http://mirrors.163.com/centos/6/os/x86_64/Packages/ 下载对应的更新包
3. 备份原有yum源,下载新163yum源(这里备份到/homt/users/yumtmp)
cd /etc/yum.repos.d/
mv ./*.repo /home/users/yumtmp
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
4. 清空缓存,重建缓存
yum clean all
yum makecache
二、下载docker安装依赖包
mkdir /usr/local/docker
cd /usr/local/docker
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -ivh epel-release-latest-6.noarch.rpm
三、下载device-mapper-libs(下载地址http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/)
mkdir /usr/local/docker/device-mapper-libs
yum install --downloadonly --downloaddir=/usr/local/docker/device-mapper-libs device-mapper-libs
cd /usr/local/docker/device-mapper-libs
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/device-mapper-1.02.117-12.el6_9.1.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/device-mapper-event-1.02.117-12.el6_9.1.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/device-mapper-event-libs-1.02.117-12.el6_9.1.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/device-mapper-libs-1.02.117-12.el6_9.1.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/device-mapper-persistent-data-0.6.2-0.2.rc7.el6.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/lvm2-2.02.143-12.el6_9.1.x86_64.rpm
wgethttp://mirrors.aliyun.com/centos/6/os/x86_64/Packages/lvm2-libs-2.02.143-12.el6_9.1.x86_64.rpm
检查是否都包含以下文件:
四、进入docker目录,检查是否有响应的安装包
cd /usr/local/docker
ll -lh
查看是否包含以下安装包
缺少包信息到以下地址下载
https://download.csdn.net/download/aaron_2046/11340564
五、拷贝目录进行安装(这里存放在/usr/local/src目录下)
cp -rf /usr/local/docker /usr/local/src
cd /usr/local/src/docker
rpm -ivh lxc-libs-1.0.11-1.el6.x86_64.rpm
rpm -ivh lua-alt-getopt-0.7.0-1.el6.noarch.rpm
rpm -ivh lua-filesystem-1.4.2-1.el6.x86_64.rpm
rpm -ivh lua-lxc-1.0.11-1.el6.x86_64.rpm
rpm -ivh lxc-1.0.11-1.el6.x86_64.rpm
rpm -ivh libcgroup-0.40.rc1-26.el6.x86_64.rpm
rpm -ivh docker-io-1.7.1-2.el6.x86_64.rpm
六、到这里基本安装完成了,启动服务
方式一:
# docker -d
方式二:
# /etc/init.d/cgconfig restart
方式三:
# service docker restart
七、错误排查
1. 问题1,如果出现以下错误
执行以下命令:
# cd/usr/local/src/docker/device-mapper-libs
# rpm -ivh device-mapper-*.rpm --force --nodeps
2. 问题2,如果出现以下错误
执行vim /usr/bin/yum
在文件第一行修改成 #!/usr/bin/python2.6 #注意这里python2.6是python 2.6版本的启动路径,找不到路径可以用命令whereis python 命令查找python 2.6版本启动路径
然后:wq保存退出文件
再对问题1进行排查
八、新建一个镜像试试
参考https://www.jianshu.com/p/5b09394bebfe
如果我们要开机启动,使用命令
sudo chkconfig docker on