knowledge/docs/docker/command.md

39 lines
615 B
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.

# docker命令备忘
## 基础操作
### 查看磁盘占用
```sh
# 查看镜像、容器、卷的总磁盘占用情况
docker system df
# 查看每个image、container的详细空间占用情况
docker system df -v
```
## 清理操作
### 删除关闭的容器和未使用的镜像
```sh
docker system prune -a
```
## 镜像操作
### 把容器导出为镜像
```sh
docker commit <容器ID或容器名> <镜像名>:<镜像tag>
```
### 镜像导入导出save & load
```sh
docker save -o <要保存的文件名>.tar <本地镜像名>:<本地镜像tag>
```
```sh
docker load > <镜像文件名>
```