完全删除Docker

在使用了docker一段时间后,会发现系统上各种容器乱七八糟,启动的,未启动的,正常运行的,异常的,搞得人不胜其烦。

下面是一次完全删除docker容器并删除docker本身的实例,可以完美解决以上问题。

查询并停止/删除当前运行容器

➜  ~ docker ps -aq
80bb62721c12

# 停止当前运行容器
➜  ~ docker stop $(docker ps -aq)
80bb62721c12

# 删除当前运行容器
➜  ~ docker rm $(docker ps -aq)
80bb62721c12

删除所有image镜像

➜  ~ docker rmi $(docker images -q)
Untagged: traffmonetizer/cli_v2:latest
Untagged: traffmonetizer/cli_v2@sha256:4fc48893746664471a1c386efabb5eba0537955fe5ecae871ed4a5e5c33ecf03
Deleted: sha256:3f82fd6f8f4f5ae49cf715a45db4abb3c0bef25be4d351ebe82e747f8641dd0b
Deleted: sha256:d732b5c154d947acd46254d7c729eea712f5dd3e0518884a50cc4ada4da9706d
Deleted: sha256:037fbfa145577a9bc6472afdf57979ff128102d42806eebc4dcdbc7eb0c91ff5
Deleted: sha256:e44bc785a3f33dea2990cff187bc1c2b7fea4fa9dfa24a6c3ad3e4c149e7aa80
Deleted: sha256:aa0a4b16279d7f4e301aa29ff8bb3fb2e5eaf2417e8119bd3c92f99da975d674
Deleted: sha256:54d0ead5d2a5dd2e830b333508445bc7e9cbed60b1ec4091d667c71349a9b31c
Deleted: sha256:bd00ba4d604e3a30bba51756da10622d2242a8540dc03a46a07584575d736590
Deleted: sha256:d4fc045c9e3a848011de66f34b81f052d4f2c15a17bb196d637e526349601820

卸载docker

➜  ~ apt purge docker-ce
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  pigz
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 109 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 64321 files and directories currently installed.)
Removing docker-ce (5:27.2.0-1~debian.12~bookworm) ...
(Reading database ... 64312 files and directories currently installed.)
Purging configuration files for docker-ce (5:27.2.0-1~debian.12~bookworm) ...
➜  ~ apt purge docker-ce-cli
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  pigz
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  docker-ce-cli*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 40.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 64310 files and directories currently installed.)
Removing docker-ce-cli (5:27.2.0-1~debian.12~bookworm) ...
Processing triggers for man-db (2.11.2-2) ...
➜  ~ apt purge docker-ce-rootless-extras docker-buildx-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libslirp0 pigz slirp4netns
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  docker-buildx-plugin* docker-ce-rootless-extras*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 102 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 64111 files and directories currently installed.)
Removing docker-buildx-plugin (0.16.2-1~debian.12~bookworm) ...
Removing docker-ce-rootless-extras (5:27.2.0-1~debian.12~bookworm) ...
➜  ~ apt purge docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libslirp0 pigz slirp4netns
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  docker-compose-plugin*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 63.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 64102 files and directories currently installed.)
Removing docker-compose-plugin (2.29.2-1~debian.12~bookworm) ...

30个帮你提高效率的BASH别名

alias其实就是一个命令的快捷方式,为了将复杂的命令简化成简洁的样子。比如我们常用的ll命令其实就是ls -l命令的alias,这里的ll就是一个alias

显示alias

使用alias显示当前所有别名,默认情况下将显示当前用户定义的所有alias

nvtop – Linux下一款强大的GPU任务监视器

nvtop 命令是基于 ncurses(新的 curses 库,在终端中显示信息)的 GPU 状态查看器,用于 AMD、Intel 和 NVIDIA GPU。换言之,您可以将此交互式 GPU 进程查看器用于 Linux 上的以下 GPU:

  • 使用 amdgpu 驱动程序的 AMD GPU。
  • 使用 i915 Linux 驱动程序的 Intel 显卡。
  • 使用 NVIDIA 驱动程序的 Nvidia GPU 以及从 GeForce 600、GeForce 800M 和后续产品开始的任何东西都应该可以正常工作。
  • Qualcomm 开发的 Adreno GPU
  • Apple GPU(M 系列)

在Linux上安装nvtop

  • Arch Linux