一 安装docker(详解)

一、安装docker

1 Docker 要求 CentOS 系统的内核版本高于 3.10

执行命令:uname -r

2 添加yum源:

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

3 查看docker仓库中所有版本

yum list docker-ce --showduplicates | sort -r

4 安装docker

yum install docker-ce

5 指定安装版本 yum install docker-ce-18.09.6.ce -y

6 启动并加入开机启动

systemctl start docker systemctl enable docker

第二种安装方式

1 yum -y install yum-utils device-mapper-persistent-data lvm2

2 添加yum源

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

3 更新yum源

yum makecache fast

4 安装docker

yum install docker-ce

添加国内镜像

vim /etc/docker/daemon.json { "registry-mirrors": ["http://hub-mirror.c.163.com"] }  重启服务 systemctl restart docker.service

国内加速镜像有

Docker中国区官方镜像 https://registry.docker-cn.com

网易 http://hub-mirror.c.163.com

ustc https://docker.mirrors.ustc.edu.cn

中国科技大学 https://docker.mirrors.ustc.edu.cn

阿里云容器 服务 https://cr.console.aliyun.com/

猜你喜欢

转载自www.cnblogs.com/taoge8788/p/11450932.html