官方参考文档
https://docs.docker.com/engine/install/centos/
1、安装
[root@localhost opt]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@localhost opt]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@localhost opt]# yum install docker-ce docker-ce-cli containerd.io
[root@localhost opt]# yum install docker-ce docker-ce-cli
2、启动
[root@localhost opt]# systemctl start docker
3、查看版本
[root@localhost opt]# docker --version Docker version 20.10.3, build 48d30b5
4、系统自启动
[root@localhost opt]# systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.