安装docker-ce
1、设置yum源
[root@Centos01 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@Centos01 ~]# yum-config-manager --add-repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
[root@Centos01 ~]# vi /etc/yum.repo.d/docker-ce.repo
//将镜像源baseurl改为上面清华的,下载镜像时会快些
在末行模式下进行全文替换,:%s@download.docker.com@mirrors.tuna.tsinghua.edu.cn/docker-ce@而后保存退出
2、安装docker-ce
[root@Centos01 ~]# yum list docker-ce --show-duplicates |sort -r
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
//只是截取部分
[root@Centos01 ~]# yum install docker-ce-18.06.0.ce -y
3、docker-ce的配置文件:/etc/docker/daemon.json 这个要自己创建,用来放加速配置
[root@Centos01 ~]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://mirrors.tuna.tsinghua.edu.cn"]
}
//启动服务后docker info 可以看到配置的镜像源
[root@Centos01 ~]# systemctl start docker
[root@Centos01 ~]# docker info
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://mirrors.tuna.tsinghua.edu.cn/
[root@Centos01 ~]# docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false