简体   繁体   English

如何从 Mac 上完全卸载 Docker?

[英]How to uninstall Docker completely from a Mac?

I would like to remove the Docker toolbox completely from my Mac.我想从我的 Mac 中完全删除 Docker 工具箱。 I tried to remove Docker from the /Applications folder, but it didn't work out.我试图从/Applications文件夹中删除 Docker,但没有成功。

Start Docker.启动 Docker。 Go to the Docker Preferences from its menu bar icon.从其菜单栏图标转到 Docker 首选项。 Within there is a 'Power Button' icon labeled "Reset".里面有一个标有“重置”的“电源按钮”图标。 Click on that and then click the "Uninstall" button.单击它,然后单击“卸载”按钮。

To uninstall Docker Toolbox from Mac, first simply download the following Docker Toolbox Uninstall Shell Script to your local machine.要从 Mac 卸载Docker Toolbox ,首先只需将以下Docker Toolbox Uninstall Shell 脚本下载到本地计算机。

Use the Terminal application on your Mac (ie Press CMD + Space to open Spotlight Search and enter keyword "Terminal") to change into the directory it was downloaded into (ie cd ~/Downloads ), and then execute the file with sudo bash uninstall.sh .使用 Mac 上的终端应用程序(即按CMD + Space打开 Spotlight Search 并输入关键字“终端”)切换到它下载到的目录(即cd ~/Downloads ),然后使用sudo bash uninstall.sh执行文件sudo bash uninstall.sh

Remove all Docker Machine VMs:删除所有 Docker 机器 VM:

docker-machine rm -f $(docker-machine ls -q);

Remove the application:删除应用程序:

rm -rf /Applications/Docker.app

Remove docker binaries:删除 docker 二进制文件:

rm -f /usr/local/bin/docker
rm -f /usr/local/bin/docker-machine
rm -r /usr/local/bin/docker-machine-driver*
rm -f /usr/local/bin/docker-compose

Remove boot2docker.iso :删除boot2docker.iso

rm -rf /usr/local/share/boot2docker

Forget packages:忘记包裹:

pkgutil --forget io.docker.pkg.docker
pkgutil --forget io.docker.pkg.dockercompose
pkgutil --forget io.docker.pkg.dockermachine
pkgutil --forget io.boot2dockeriso.pkg.boot2dockeriso

To uninstall Docker卸载 Docker

This article from 2014 lists all directories and binaries in detail that you need to remove to delete the installation completely:这篇 2014 年的文章详细列出了您需要删除以完全删除安装的所有目录和二进制文件:

https://therealmarv.com/how-to-fully-uninstall-the-offical-docker-os-x-installation/ https://therealmarv.com/how-to-fully-uninstall-the-offical-docker-os-x-installation/

Includes boot2docker.包括 boot2docker。

Of course, you probably find a lot by just typing "docker" into the finder search box.当然,您可能只需在查找器搜索框中键入“docker”即可找到很多内容。 The applications themselves can be removed by deleting the /Applications/Docker folder.可以通过删除/Applications/Docker文件夹来删除应用程序本身。

To uninstall VirtualBox卸载 VirtualBox

  1. download the *.dmg of VirtualBox for your version if you don't have it anymore如果您不再拥有 VirtualBox 的 *.dmg 版本,请下载它
  2. click on the uninstall tool in that dmg单击该 dmg 中的卸载工具

See: https://www.virtualbox.org/manual/ch02.html#idm871请参阅: https : //www.virtualbox.org/manual/ch02.html#idm871

I realize this question is old enough that it refers to Docker Toolbox instead of Docker Desktop .我意识到这个问题已经足够老了,它指的是Docker Toolbox而不是Docker Desktop My response is in regards to Docker Desktop, the latest as of this answer.我的回答是关于 Docker 桌面的,这是这个答案的最新版本。

You have two ways: Command Line or GUI.您有两种方法:命令行或 GUI。

  1. Via command line you execute the following command:通过命令行,您可以执行以下命令:

    $ /Applications/Docker.app/Contents/MacOS/Docker --uninstall $ /Applications/Docker.app/Contents/MacOS/Docker --uninstall

The command line should bring up something like this:命令行应该显示如下内容:

Docker is running, exiting... Docker uninstalled successfully. Docker 正在运行,正在退出... Docker 已成功卸载。 You can move the Docker application to the trash.您可以将 Docker 应用程序移至垃圾箱。

  1. With the GUI, open the Troubleshooting option and then choose Uninstall.使用 GUI,打开故障排除选项,然后选择卸载。

图形用户界面卸载

On my Mac M1, I could start the Docker app, but it was hanging on starting.在我的 Mac M1 上,我可以启动 Docker 应用程序,但它在启动时挂起。 So, this is the only thing that worked for me after deleting the Docker app (with some restarts in there):所以,这是删除 Docker 应用程序后唯一对我有用的东西(其中有一些重启):

rm -rf ~/Library/Group\ Containers/group.com.docker
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/.docker

Then, you should be able to reinstall the Docker dmg install file.然后,您应该能够重新安装 Docker dmg安装文件。

There is an official uninstall script:有一个官方的卸载脚本:

https://github.com/boot2docker/osx-installer/blob/master/uninstall.sh https://github.com/boot2docker/osx-installer/blob/master/uninstall.sh

I used it successfully by entering the commands one at a time in the command line.我通过在命令行中一次输入一个命令来成功使用它。

It seems all the answers are dated.似乎所有的答案都过时了。 As of 2022, there's a section of the docs dedicated to this: https://docs.docker.com/desktop/mac/install/#uninstall-docker-desktop截至 2022 年,文档中有一部分专门用于此: https://docs.docker.com/desktop/mac/install/#uninstall-docker-desktop

Quoting:报价:

To uninstall Docker Desktop from your Mac:要从 Mac 卸载 Docker Desktop:

  • From the Docker menu, select Troubleshoot and then select Uninstall.从 Docker 菜单,select 故障排除,然后 select 卸载。
  • Click Uninstall to confirm your selection.单击卸载以确认您的选择。

Uninstall Docker Desktop卸载Docker桌面

To uninstall Docker Desktop from your Mac:要从 Mac 卸载 Docker Desktop:

From the Docker menu, select Troubleshoot and then select Uninstall.从 Docker 菜单,select 故障排除,然后 select 卸载。 Click Uninstall to confirm your selection.单击卸载以确认您的选择。 Uninstall Docker Desktop from the command line从命令行卸载 Docker Desktop

To uninstall Docker Desktop from a terminal, run: <path to Docker app>/Contents/MacOS/uninstall .要从终端卸载 Docker Desktop,请运行: <path to Docker app>/Contents/MacOS/uninstall If your instance is installed in the default location, this command provides a clean uninstall:如果您的实例安装在默认位置,则此命令提供完全卸载:

$ /Applications/Docker.app/Contents/MacOS/uninstall
Uninstalling Docker Desktop...
Docker uninstalled successfully. You can move the Docker application to the trash.

You might want to use the command-line uninstall if, for example, you find that the app is non-functional, and you cannot uninstall it from the menu.例如,如果您发现该应用程序无法正常运行,并且您无法从菜单中将其卸载,您可能希望使用命令行卸载。 Note笔记

Uninstalling Docker Desktop destroys Docker containers, images, volumes, and other Docker related data local to the machine, and removes the files generated by the application.卸载 Docker Desktop 会破坏 Docker 容器、图像、卷和机器本地的其他 Docker 相关数据,并删除应用程序生成的文件。 Refer to the back up and restore data section to learn how to preserve important data before uninstalling.请参阅备份和恢复数据部分,了解如何在卸载前保留重要数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM