1.下载所需yum软件包
yum install -y yum-utils device-mapper-persistent-data lvm2 --skip-broken
2.设置docker镜像源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
3.清理缓存
yum makecache fast
4。下载docker
yum install -y docker-ce
5.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
6.启动docker
systemctl start docker
7.开机自启
systemctl enable docker
8.查看版本
docker -v
脚本如下:
vim install_docker.sh
yum install -y yum-utils device-mapper-persistent-data lvm2 --skip-broken
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum install -y docker-ce
systemctl stop firewalld
systemctl disable firewalld
systemctl start docker
systemctl enable docker
docker -v
chmod 777 install_docker.sh
sh install_docker.sh