0%

Docker|1.安装部署

CentOS7 安装Docker

删掉之前的docker版本

1
yum remove docker docker-common docker-selinux docker-engine

安装相关依赖

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

添加软件源信息

1
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新并安装Docker-CE

1
2
yum makecache fast
sudo yum -y install docker-ce

开启Docker服务

1
systemctl start docker

查看安装信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:24:18 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683

配置阿里云镜像加速

推荐安装1.10.0以上版本的Docker客户端

使用阿里云账号登录

1
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

配置镜像加速器

1
2
3
4
5
6
7
8
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://yk5r9j0f.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker