一、看官方地址选择平台,我的是centos7 系统

https://docs.docker.com/install/linux/docker-ce/centos/

 二、安装依赖

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

 三、添加软件仓库,我们这⾥使⽤稳定版 Docker,执⾏下⾯命令添加 yum 仓库地址:

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

 四、然后直接安装即可:

yum install docker-ce -y

   五、如果要安装指定的版本,可以使⽤ yum list 列出可⽤的版本:

yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64            18.06.3.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable

 六、如这⾥可以安装18.03.0.ce版本:

sudo yum install docker-ce-18.03.0.ce

 七、启动 Docker

sudo systemctl enable docker
sudo systemctl start docker
另外⼀种安装⽅式是可以直接下载指定的软件包直接安装即可,前往地
址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/ 找到合适的 .rpm 包下载,
然后安装即可:

sudo yum install /path/to/package.rpm
01-18 17:17