Skip to content

3. Docker 管理

清除缓存

禁止使用清除全部功能,镜像和一些停止的容器也可能包含重要信息。

建议清除 Dangling 镜像,即旧的、没有标签的镜像:

bash
docker image prune -f

未使用的网络也可能会被其他容器使用,谨慎清除:

bash
docker network prune -f

构建缓存对于开发环境非常有用,建议不要频繁清除:

bash
docker builder prune -a -f

未使用的卷也可能包含重要信息,谨慎清除:

bash
docker volume prune -f