参考:https://blog.csdn.net/qq_42214817/article/details/84373084
CentOS6.8安装Docker
五个步骤安装
1.yum install -y epel-release
Docker使用EPEL发布,RHEL系的OS首先要确保已经持有EPEL仓库,否则先检查OS的版本,然后安装相应的EPEL包。
2.yum install -y docker-io
3.安装后的配置文件:/etc/sysconfig/docker
4.启动Docker后台服务:service docker start
5.docker version验证
三、CentOS7安装Docker
官网安装教程https://docs.docker.com/install/linux/docker-ce/centos/
官网中文安装参考手册https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#prerequisites
1.确定你是CentOS7及以上版本
cat /etc/redhat-release
2.yum安装gcc相关
CentOS7能上外网
yum -y install gcc
yum -y install gcc-c++
3.卸载旧版本
yum -y remove docker docker-common docker-selinux docker-engine
备注:2018.3官网版本介绍如下
yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine
4.安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
5.设置stable镜像仓库
大坑:yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
报错: [Errno 14] curl#35 - TCP connection reset by peer [Errno 12] curl#35 - Timeout
推荐:yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6.更新yum软件包索引
yum makecache fast
7.安装DOCKER CE
yum -y install docker-ce
8.启动docker
systemctl start docker
9.测试
docker version
docker run hello-world
10.配置镜像加速
a).mkdir -p /etc/docker
b).vim /etc/docker/daemon.json
备注:
#网易云
{“registry-mirrors”: [“http://hub-mirror.c.163.com”] }
#阿里云
{
“registry-mirrors”: [“https://{自已的编码}.mirror.aliyuncs.com”]
}
这个快,上面那个地址垃圾:https://blog.csdn.net/eva001206130/article/details/79753694
c).systemctl daemon-reload
d).systemctl restart docker
11.卸载
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker