mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-08-02 22:11:38 +00:00
add sections to cleanup unused containers and images
This commit is contained in:
@@ -7,3 +7,8 @@ trusting_newton
|
||||
```
|
||||
如果要删除一个运行中的容器,可以添加 `-f` 参数。Docker 会发送 `SIGKILL` 信号给容器。
|
||||
|
||||
|
||||
##清理所有处于终止状态的容器
|
||||
用 `docker ps -a` 命令可以查看所有已经创建的包括终止状态的容器,如果数量太多要一个个删除可能会很麻烦,用 `docker rm $(docker ps -a -q)` 可以全部清理掉。
|
||||
|
||||
*注意:这个命令其实会试图删除所有的包括还在运行中的容器,不过就像上面提过的 `docker rm` 默认并不会删除运行中的容器。
|
Reference in New Issue
Block a user