vault backup: 2026-11-07 16:33:44
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
|
||||
## 检查 Docker 是否安装[](https://amprobe.amuluze.com/doc/views/docker.html#%E6%A3%80%E6%9F%A5-docker-%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85)
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ docker -v
|
||||
Docker version 25.0.3, build 4debf41
|
||||
```
|
||||
|
||||
如果输出以上信息,则表示 Docker 已经安装。
|
||||
|
||||
## 安装并启动 Docker[](https://amprobe.amuluze.com/doc/views/docker.html#%E5%AE%89%E8%A3%85%E5%B9%B6%E5%90%AF%E5%8A%A8-docker)
|
||||
|
||||
> 如果已经安装 Docker,则跳过该步骤,下面 `Ubuntu 22.04` 安装 Docker 的步骤
|
||||
|
||||
### 安装[](https://amprobe.amuluze.com/doc/views/docker.html#%E5%AE%89%E8%A3%85)
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
```
|
||||
|
||||
### 安装依赖[](https://amprobe.amuluze.com/doc/views/docker.html#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96)
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release
|
||||
```
|
||||
|
||||
**添加 `docker` 的官方 `GPG` 密钥**
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
```
|
||||
|
||||
**添加 `docker` 官方库**
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
```
|
||||
|
||||
**更新 `ubuntu` 源列表**
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
```
|
||||
|
||||
**安装最新 `docker-ce`**
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
```
|
||||
|
||||
### 检查[](https://amprobe.amuluze.com/doc/views/docker.html#%E6%A3%80%E6%9F%A5)
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo systemctl status docker
|
||||
● docker.service - Docker Application Container Engine
|
||||
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Thu 2024-01-11 21:37:25 CST; 17s ago
|
||||
TriggeredBy: ● docker.socket
|
||||
Docs: https://docs.docker.com
|
||||
Main PID: 51116 (dockerd)
|
||||
Tasks: 8
|
||||
Memory: 25.8M
|
||||
CPU: 213ms
|
||||
CGroup: /system.slice/docker.service
|
||||
└─51116 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
|
||||
|
||||
Jan 11 21:37:24 hecs-398409 systemd[1]: Starting Docker Application Container Engine...
|
||||
Jan 11 21:37:24 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:24.527450424+08:00" level=info msg="Starting up"
|
||||
Jan 11 21:37:24 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:24.530213574+08:00" level=info msg="detected 127.0.0.>
|
||||
Jan 11 21:37:24 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:24.625114442+08:00" level=info msg="Loading container>
|
||||
Jan 11 21:37:25 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:25.269789956+08:00" level=info msg="Loading container>
|
||||
Jan 11 21:37:25 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:25.300116824+08:00" level=info msg="Docker daemon" co>
|
||||
Jan 11 21:37:25 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:25.300207349+08:00" level=info msg="Daemon has comple>
|
||||
Jan 11 21:37:25 hecs-398409 dockerd[51116]: time="2024-01-11T21:37:25.331215962+08:00" level=info msg="API listen on /ru>
|
||||
Jan 11 21:37:25 hecs-398409 systemd[1]: Started Docker Application Container Engine.
|
||||
```
|
||||
|
||||
### 卸载[](https://amprobe.amuluze.com/doc/views/docker.html#%E5%8D%B8%E8%BD%BD)
|
||||
|
||||
bash
|
||||
|
||||
```
|
||||
$ sudo apt-get purge docker.io
|
||||
$ sudo rm -rf /var/lib/docker
|
||||
```
|
||||
Reference in New Issue
Block a user