CentOS7 安装 Docker

Centos7配置国内yum源和epel源

1
2
3
4
5
6
7
8
9

cd /etc/yum.repos.d/ && mkdir repo_bak && mv *.repo repo_bak/

wget http://mirrors.aliyun.com/repo/Centos-7.repo

wget http://mirrors.aliyun.com/repo/epel-7.repo

yum clean all && yum makecache

CentOS7安装docker(参考官方文档)

官方地址: 传送门

1
2
3
4
5
6
7

yum install -y yum-utils && yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

systemctl start docker && systemctl enable docker

加速服务

1
2
3
4
5
6
7
8
9
10
11
12
13
# vim /etc/docker/daemon.json
{
"data-root": "/data/dockerdata",
"registry-mirrors": [
"https://docker.1ms.run",
"https://docker.1panel.live"
],
"dns": [
"8.8.8.8",
"114.114.114.114"
]
}

sudo systemctl daemon-reload
sudo systemctl restart docker