Rhel

如何使用 yum 或任何其他方法刪除 docker

  • May 10, 2020

今天我們使用以下 rpm(32 rpm)安裝了 docker,在rhel 7.2

rpm -qa --last|more
libselinux-devel-2.5-15.el7.x86_64            Sun 10 May 2020 07:03:31 AM UTC
libselinux-2.5-15.el7.i686                    Sun 10 May 2020 07:03:31 AM UTC
docker-ce-19.03.8-3.el7.x86_64                Sun 10 May 2020 07:03:31 AM UTC
libsepol-2.5-10.el7.i686                      Sun 10 May 2020 07:03:27 AM UTC
docker-ce-cli-19.03.8-3.el7.x86_64            Sun 10 May 2020 07:03:26 AM UTC
libsepol-devel-2.5-10.el7.x86_64              Sun 10 May 2020 07:03:19 AM UTC
libseccomp-2.3.1-4.el7.x86_64                 Sun 10 May 2020 07:03:19 AM UTC
containerd.io-1.2.13-3.1.el7.x86_64           Sun 10 May 2020 07:03:19 AM UTC
setools-libs-3.3.8-4.el7.x86_64               Sun 10 May 2020 07:03:06 AM UTC
policycoreutils-python-2.5-34.el7.x86_64      Sun 10 May 2020 07:03:06 AM UTC
libsemanage-python-2.5-14.el7.x86_64          Sun 10 May 2020 07:03:06 AM UTC
libselinux-python-2.5-15.el7.x86_64           Sun 10 May 2020 07:03:06 AM UTC
container-selinux-2.119.1-1.c57a6f9.el7.noarch Sun 10 May 2020 07:03:06 AM UTC
.
.
.
.
.

現在我們要刪除 docker

如上所述刪除 docker rpm 的最佳方法是什麼

第一種方式是這樣的

yum remove libselinux-devel-2.5-15.el7.x86_64 libselinux-2.5-15.el7.i686 docker-ce-19.03.8-3.el7.x86_64 ....

但實際上通過yum remove所有列表刪除 rpm 很笨拙

還有其他想法嗎?

只需撤消最後一筆交易:

yum history undo last

這個怎麼樣 -

rpm -qa | grep docker | xargs yum remove -y

或者

rpm -qa --last | awk '{system("yum remove -y "$1)}'

引用自:https://unix.stackexchange.com/questions/585670