centos6.8-安装docker

基于CentOS6.8下安装Docker

一、查看linux系统版本

[root@Centos1 ~]# uname -a
Linux Centos1 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@Centos1 ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@Centos1 ~]# 

二、安装EPEL

因为系统自带的repo中不带docker需要安装epel

[root@Centos1 ~]# rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://ftp.riken.jp/Linux/fedora/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
Preparing...                ########################################### [100%]
	package epel-release-6-8.noarch is already installed
[root@Centos1 ~]#sudo yum install docker-io

一直提示:

[root@Centos1 ~]# yum install -y docker-io
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
No package docker-io available.
Error: Nothing to do

尝试过很多方式:

执行命令:yum update 更新yum

执行命令:yum clean all

再执行命令:yum  install -y  epel-realease,还是不行

查了资料都说是因为这个源是国外的源,用在命令应为GFE被墙,根本安装不了。

执行命令:yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

截取后半部分成功记录:

Total size: 19 M
Total download size: 131 k
Installed size: 20 M
Is this ok [y/N]: y
Downloading Packages:
libcgroup-0.40.rc1-27.el6_10.x86_64.rpm                  | 131 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libcgroup-0.40.rc1-27.el6_10.x86_64                          1/2 
  Installing : docker-engine-1.7.1-1.el6.x86_64                             2/2 
  Verifying  : docker-engine-1.7.1-1.el6.x86_64                             1/2 
  Verifying  : libcgroup-0.40.rc1-27.el6_10.x86_64                          2/2 

Installed:
  docker-engine.x86_64 0:1.7.1-1.el6                                            

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-27.el6_10                                         

Complete!

执行命令:service docker start

[root@Centos1 ~]# service docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:	                                   [  OK  ]

说明docker安装成功!

 

在公司电脑安装docker遇到的问题:

依次执行以下命令:

1.执行命令:rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/6Server/x86_64/epel-release-6-8.noarch.rpm

2.执行命令: yum install -y docker-io

3.执行命令:yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

尝试解决1:修改源地址为官网

  cd /etc/yum.repos.d

  vi upgradetool.repo

修改镜像源,将地址改成mirror

baseurl=http://mirror.centos.org/centos/6/upg/x86_64/

还是不行

尝试解决2:修改DNS配置

vi /etc/resolv.conf 

尝试过加:

  nameserver 114.114.114.114
  nameserver 202.96.128.86
  search localdomain

也还是不行

尝试三,最笨的方法,检查地址是否正确:

1.直接将地址复制再浏览器打开:http://mirror.centos.org,原来我配置里面的地址错了,一直解析不出来。

 

 

2.修改地址配置,再执行:yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

成功!

 

 

3.验证是否安装docker成功:

docker --verison

 

成功!

 

posted @ 2019-10-27 21:43  做一只热爱生活的小透明  阅读(276)  评论(0)    收藏  举报