1.关闭防火墙
- systemctl stop firewalld #关闭防火墙
- systemctl disable firewalld #设置开机不启
2.禁用selinux
[root@master ~]# setenforce 0 #临时关闭selinux
[root@master ~]# getenforce #查看selinux状态
Permissive
[root@master ~]# vim /etc/selinux/config #永久关闭selinux
SELINUX=disabled
3.yum源和基础配置
安装yum-utils,主要提供yum-config-manager命令
yum install -y yum-utils
下载并安装docker的repo仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4.配置网卡转发
5.更新软件
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache fast
6.yum安装
安装指定版本*
yum -y install docker-ce-20.10.9 docker-ce-cli-20.10.9 containerd.io
设置开机自启
systemctl enable docker
启动docker*
systemctl start docker
7.修改加速镜像
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
- 重新启动
- systemctl daemon-reload
- systemctl restart docker