Search code examples
dockerkubernetesdocker-desktop

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. It runs all the time using up the MacBook battery.

On a simple search, there are docs showing how to stop the containers but not the docker service itself.

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?


Solution

  • The docker desktop app starts a qemu vm, so the desktop app has no control over the PIDs. To overcome the "situation" do the following:

    • open the Terminal app

    • edit the file ~/.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.)