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
2. 使用repository安装docker ce
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce如果想安装指定版本的docker-ce,可以先用如下命令查看版本号,然后
$ yum list docker-ce --showduplicates | sort -r
$ sudo yum install docker-ce-<VERSION STRING> #例如docker-ce-18.03.0.ce
3. 安装docker-compose
curl -L https://github.com/docker/compose/releases/download/1.23.0-rc3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
上面安装的是当前最新版本的compose,可以到github上找 https://github.com/docker/compose/releases
4. 卸载docker-ce
$ sudo yum remove docker-ce $ sudo rm -rf /var/lib/docker
5. 卸载docker-compse
sudo rm /usr/local/bin/docker-compose
原文地址:https://www.cnblogs.com/nieqibest/p/9846655.html
时间: 2024-10-06 23:07:43