简体   繁体   English

如何使用 Docker 桌面停止 Docker(和 Kubernetes)?

[英]How to stop Docker (and Kubernetes) using Docker desktop?

I'm running Docker Desktop for MacOS and I don't know how to stop the Docker service.我正在为 MacOS 运行 Docker 桌面,但我不知道如何停止 Docker 服务。 It runs all the time using up the MacBook battery.它一直运行,耗尽 MacBook 电池。

On a simple search, there are docs showing how to stop the containers but not the docker service itself.在简单的搜索中,有一些文档显示了如何停止容器而不是 docker 服务本身。

I might be missing something obvious, but is there a way to stop both Kubernetes and Docker service without having to kill the desktop app?我可能遗漏了一些明显的东西,但是有没有办法同时停止 Kubernetes 和 Docker 服务而不必终止桌面应用程序?

You can just quit the docker desktop last option in your image .您可以退出last option in your image的 docker 桌面last option in your image It will exit the docker and kubernetes also.它也将退出 docker 和 kubernetes。

Thanks谢谢

Ashish阿西什

You can open the Activy Monitor, select Docker and then use the Quit button.您可以打开 Active Monitor,选择 Docker,然后使用退出按钮。

Maybe you will need to use the Force Quit option.也许您需要使用强制退出选项。

在此处输入图片说明

I had been searching around for an answer to this too, as I noticed com.docker.hyperkit was taking >3GB memory and a lot of CPU, when the desktop app wasn't even opened on Mac OS X Catalina, Docker Desktop 3.0.4我也一直在四处寻找答案,因为我注意到com.docker.hyperkit占用了 >3GB 内存和大量 CPU,当桌面应用程序甚至没有在 Mac OS X Catalina、Docker Desktop 3.0 上打开时。 4

Just as I was about kill -9 , I noticed that quitting the docker app again actually did kill off every process except com.docker.vmnetd for whatever reason.就像我说kill -9 ,我注意到再次退出com.docker.vmnetd应用程序实际上确实杀死了除com.docker.vmnetd之外的所有进程,无论出于何种原因。

So I guess the solution here was... reopen and re-quit?所以我想这里的解决方案是...重新打开并重新退出? I also made sure, of course, there were no running containers.当然,我还确保没有正在运行的容器。 I removed an old image too, unsure if that was related to it finally being able to fully quit.我也删除了一个旧图像,不确定这是否与它最终能够完全退出有关。

The docker desktop app starts a qemu vm, so the desktop app has no control over the PIDs. docker 桌面应用程序启动一个 qemu vm,因此桌面应用程序无法控制 PID。 To oversome the "situation" do the following:要过度处理“情况”,请执行以下操作:

  • open the Terminal app打开终端应用程序

  • edit the file ~/.bash_profile编辑文件~/.bash_profile

  • add the following lines添加以下几行

#macro to kill the docker desktop app and the VM (excluding vmnetd -> it's a service)
    function kdo() {
      ps ax|grep -i docker|egrep -iv 'grep|com.docker.vmnetd'|awk '{print $1}'|xargs kill
    }
  • save the file保存文件

Quit the terminal app and open it again.退出终端应用程序并再次打开它。

Type kdo to kill all the dependend apps (hypervisor, docker daemon etc.)键入kdo以杀死所有依赖的应用程序(管理程序、docker 守护进程等)

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

相关问题 docker for desktop 如何与Kube.netes交互 - How to interact with Kubernetes on docker for desktop 如何在 Docker 桌面上创建一个新的 Kubernetes 集群? - How to create a new Kubernetes cluster on Docker Desktop? 如何让 kubernetes 在 Windows 桌面的 docker 中运行 - how to make kubernetes to run in docker for desktop in windows 如何在 MacOS 上使用 docker 桌面更新 kube.netes 证书 - How to update kubernetes certificates with docker desktop on MacOS windows docker 桌面kube.netes报错 - Error in windows docker desktop kubernetes Docker 桌面 - kube.netes 启动失败 - Docker desktop - kubernetes failed to start Kubernetes 不使用 Docker for Desktop 拉取镜像 - Kubernetes not pulling image with Docker for Desktop 从 Windows 主机到 Kubernetes 容器的共享目录(使用 Docker 桌面) - Sharing directory from Windows host to Kubernetes container (using Docker Desktop) 如何使用 docker 桌面 k8s 集群在本地主机/本地机器上部署和访问负载均衡器 kube.netes 服务? - how to deploy and access loadbalancer kubernetes service on localhost/local machine using docker desktop k8s cluster? 如何使用 docker 桌面将 kubernetes 集群连接到外部 SQL Server 数据库? - How do I connect a kubernetes cluster to an external SQL Server database using docker desktop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM