CentOS7安装docker(参考官方文档)
官方文档地址:
https://docs.docker.com/engine/install/centos/
1.卸载旧版docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.设置docker yum源(二选一)
设置为阿里云的源速度可以快一点(推荐)
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
如果不想阿里云的源,也可用官方源(可能遇到网络问题)
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3.安装docker
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4.启动docker
sudo systemctl start docker
5.设置开机自启动
sudo systemctl enable docker
6.查看版本
docker -v
docker info