add sections to cleanup unused containers and images

This commit is contained in:
Zhenkai Jiang
2015-07-03 16:45:06 +08:00
parent 94c15606b3
commit 60ec1bf62c
2 changed files with 21 additions and 0 deletions

View File

@@ -7,3 +7,8 @@ trusting_newton
```
如果要删除一个运行中的容器,可以添加 `-f` 参数。Docker 会发送 `SIGKILL` 信号给容器。
##清理所有处于终止状态的容器
`docker ps -a` 命令可以查看所有已经创建的包括终止状态的容器,如果数量太多要一个个删除可能会很麻烦,用 `docker rm $(docker ps -a -q)` 可以全部清理掉。
*注意:这个命令其实会试图删除所有的包括还在运行中的容器,不过就像上面提过的 `docker rm` 默认并不会删除运行中的容器。