1、在线安装
1.1、卸载系统之前的 docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
1.2、安装 Docker-ce
安装必须的依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
设置 docker repo 的 yum 位置
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装 docker,以及 docker-cli
sudo yum install docker-ce docker-ce-cli containerd.io
1.3、启动 docker
sudo systemctl start docker
2、离线安装
2.1 包目录预览
2.2 docker-install.sh 内容
#!/bin/bash
tar -xzvf docker-20.10.9.tgz
sudo cp docker/* /usr/bin/
sudo cp docker.socket /etc/systemd/system
sudo cp docker.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker
docker -v
echo "打印出版本号,则安装成功"
2.3 安装
sh docker-install.sh
2.4 设置开机自启
systemctl enable docker
标签:sudo,ce,systemctl,yum,Docker,安装,docker
From: https://www.cnblogs.com/ccblblog/p/17904798.html