您的位置:首页 > 运维架构 > Docker

CentOS6.8上Docker的安装

2020-04-22 09:54 357 查看

一、查看系统版本

目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。
[root@CentOS6 ~]# uname -a
Linux CentOS6.8 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@CentOS6 ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)

二、安装Docker

  1. Docker使用EPEL发布,RHEL系的OS首先要确保已经持有EPEL仓库,否则先检查OS的版本,然后安装相应的EPEL包。
RHEL:Red Hat公司发布的面向企业用户的Linux操作系统。
yum install -y epel-release
  1. 执行命令:
yum install -y docker-io

然而:报错了

[root@CentOS6 ~]# yum install -y docker-ioLoaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
epel/metalink                                                                                                                                                           | 5.4 kB     00:00
* base: mirrors.njupt.edu.cn
* epel: mirrors.njupt.edu.cn
* extras: mirrors.njupt.edu.cn
* updates: mirrors.njupt.edu.cn
epel                                                                                                                                                                    | 5.3 kB     00:00
epel/primary_db                                                                                                                                                         | 6.1 MB     00:07
No package docker-io available.
Error: Nothing to do

搜了各种答案,总结如下:

解决办法1:

yum没有找到docker包,更新epel第三方软件库,运行命令:

sudo yum install epel-release

之后再执行:

sudo yum install docker

然而我的却还是报错。

解决办法2:

Ubuntu/Debian: curl -sSL https://get.docker.com | sh

Linux 64bit binary: https://get.docker.com/builds/Linux/x86_64/docker-1.7.1

Darwin/OSX 64bit client binary: https://get.docker.com/builds/Darwin/x86_64/docker-1.7.1

Darwin/OSX 32bit client binary: https://get.docker.com/builds/Darwin/i386/docker-1.7.1

Linux 64bit tgz: https://get.docker.com/builds/Linux/x86_64/docker-1.7.1.tgz

Windows 64bit client binary: https://get.docker.com/builds/Windows/x86_64/docker-1.7.1.exe

Windows 32bit client binary: https://get.docker.com/builds/Windows/i386/docker-1.7.1.exe

Centos 6/RHEL 6: https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

Centos 7/RHEL 7: https://get.docker.com/rpm/1.7.1/centos-7/RPMS/x86_64/docker-engine-1.7.1-1.el7.centos.x86_64.rpm

Fedora 20: https://get.docker.com/rpm/1.7.1/fedora-20/RPMS/x86_64/docker-engine-1.7.1-1.fc20.x86_64.rpm

Fedora 21: https://get.docker.com/rpm/1.7.1/fedora-21/RPMS/x86_64/docker-engine-1.7.1-1.fc21.x86_64.rpm

Fedora 22: https://get.docker.com/rpm/1.7.1/fedora-22/RPMS/x86_64/docker-engine-1.7.1-1.fc22.x86_64.rpm

yum install docker-io,该命令是用源安装docker,可是源一般是国外源,用这个命令因为GFW被墙,根本安装不了

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. 安装后的配置文件
[root@CentOS6 ~]# ls -l /etc/sysconfig/docker
-rw-r--r--. 1 root root 199 Jul 15  2015 /etc/sysconfig/docker
  1. 启动Docker后台服务
service docker start
  1. Docker Version验证
docker version
  • 点赞
  • 收藏
  • 分享
  • 文章举报
qq_45620118 发布了3 篇原创文章 · 获赞 0 · 访问量 27 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: