杂项
环境安装
Docker

一键安装 Docker

curl -fsSL https://get.docker.com | bash
# 改用国内镜像
# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

Docker Image Prune

删除所有悬挂的镜像(dangling images),可以使用以下命令:

docker image prune

删除所有未被使用的镜像,可以使用以下命令:

docker image prune -a
#WARNING! This will remove all images without at least one container associated to them.
#Are you sure you want to continue? [y/N] y

Docker System Prune

删除所有未被使用的对象,可以使用以下命令:

docker system prune

默认情况下将删除:

  • Stopped containers – 所有已停止的容器
  • Networks that are not being used by at least one container - 所有未被容器使用的网络
  • Dangling images - 所有悬挂的镜像
  • Dangling build cache - 所有悬挂的构建缓存
docker system prune -a
# WARNING! This will remove:
#   - all stopped containers
#   - all networks not used by at least one container
#   - all images without at least one container associated to them
#   - all build cache
 
# Are you sure you want to continue? [y/N]