wiki-files/docker/install.md

86 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: docker的安装卸载
description: docker的安装与卸载
published: true
date: 2021-09-09T01:36:54.122Z
tags: docker
editor: markdown
dateCreated: 2021-08-02T07:22:52.894Z
---
# 安装Docker
## CentOS
#### 自动安装
```bash
$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
```
#### 手动安装
##### 卸载旧版本
```bash
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
```
或者查看已经安装的docker
```bash
$ yum list installed |grep docker
```
##### 安装
[官方安装传送门](https://docs.docker.com/engine/install/centos/)
###### 下载依赖
[选择对应CentOS版本](https://download.docker.com/linux/centos/)
下载stable版本的两个文件这里是CentOS7.5
最新安装
- containerd.io-1.4.9-3.1.el7.x86_64.rpm
- docker-ce-20.10.8-3.el7.x86_64.rpm
旧版本安装
- containerd.io-1.2.5-3.1.el7.x86_64.rpm
- docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
- docker-ce-cli-18.09.4-3.el7.x86_64.rpm
- docker-ce-18.09.4-3.el7.x86_64.rpm
###### 执行安装
```bash
$ yum install -y docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
$ yum install -y docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
```
#### 启动docker
设置开机启动
```bash
$ systemctl enable docker
```
启动
```bash
$ systemctl start docker
```
#### 删除
##### 删除安装包
```bash
$ yum remove docker-ce
```
##### 删除镜像、容器、配置文件等
```bash
$ rm -rf /var/lib/docker
```