1. 如果原虚机已经安装docker,则移出旧版docker
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
2. 首先安装系统必要工具:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3. 添加软件源信息:
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4. 更新yum缓存
sudo yum makecache fast
5. 安装docker-ce
sudo yum -y install docker-ce
6. 启动docker后台服务
sudo systemctl start docker
7. 测试用docker运行hello-world
docker run hello-world
8. 查看docker版本
docker --version
docker version
9. 查看docker信息
docker info