如何在虚拟机中安装linux操作系统,参考文章:
使用Xshell链接到linux操作系统

执行命令,安装docker的底层工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

增加阿里云docker下载仓库,为了提升下载文件的速度
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新仓库源信息,确保yum能够获取到最新的软件包信息
sudo yum makecache fast

从阿里云仓库下载docker-ce(社区版)
sudo yum -y install docker-ce

docker安装完成。
将docker服务化
sudo service docker start

启动docker服务
service docker start

查询docker版本
docker version

从镜像仓库中拉去测试用的hello-world
docker pull hello-world

启动hello-world
docker run hello-world

到此,docker就安装成功了。