Astrisk Blog

Docker-Install

• DOCKER-HACKATHON

Docker提供yum和rpm两种安装方式,可以根据自己的实际情况选择安装方式。yum安装需要联网,可以直接在线安装;而rpm一般用于不能直接连接外网的环境,先下载rpm包,上传到服务器,然后安装。

使用yum安装

Install yum-utils, which provides the yum-config-manager utility:

$ sudo yum install -y yum-utils

set up the stable repository

$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

docker-install1

Optional: Enable the edge repository

$ sudo yum-config-manager --enable docker-ce-edge

Update the yum package index

$  sudo yum makecache fast

List the available versions of docker

$  yum list docker-ce.x86_64  --showduplicates |sort -r

docker-install2

install docker-ce

$  yum install -y docker-ce.x86_64

docker-install5

docker-install6

Start Docker

$ sudo systemctl start docker

Verify that docker is installed correctly by running the hello-world image

$ sudo docker run hello-world

docker-install7

安装遇到地坑

selinux版本不满足docker-ce要求,selinux版本太低 docker-install3

查看CentOS上安装的selinux版本 docker-install4

解决方法

  • 安装docker前先看下selinux的版本,docker-ce 17 依赖的seLinux版本大等于3.13.1-102(以上elinux版本太低截图可以看出)
  • 选择比较新的版本,比如CentOS-7-x86_64-XXX-1611(验证过)
  • 安装低版本的docker-engine