1.卸载旧版本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
- 安装必要工具
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
- 添加源,这里使用了阿里云的源
$ sudo yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 安装docker社区版
$ sudo yum install docker-ce
- 启动 Docker
$ sudo systemctl start docker
- 测试
$ sudo docker run hello-world
- 安装Docker-compose所需依赖
$ sudo yum install -y install python-pip
- 安装Docker-compose
$pip install --upgrade --force-reinstall --no-cache-dir docker-compose