Documentation of filesite.io. https://filesite.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.2 KiB

2 years ago
# CentOS 7如何安装Docker Engine?
## 卸载老版本
如果之前有安装过的docker或者docker-engine(新版本名字为:docker-ce),
需要先卸载老版本:
```
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
```
## 配置yum的Docker仓库
```
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
```
## 安装新版Docker Engine
```
yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
```
## 启动Docker
启动Docker Engine并把它设置开机自动启动:
```
systemctl start docker
systemctl enable docker
```
## 卸载Docker
如果某天不需要用它了,可以按下面步骤卸载Docker Engine:
```
yum remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
```
如果之前下载和使用过的Docker镜像、容器都不需要了,可以按下面步骤删除:
```
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
```
## 参考
> https://docs.docker.com/engine/install/centos/