Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 988
Ébe Isaac Avatar asked Nov 12 '20 07:11

Ébe Isaac


People also ask

How do I stop my docker desktop from running?

Stopping a Container Using Process SignalsWith the docker run commands --stop-signal flag, you can specify the stop signal when starting the container. This flag sets the signal that will be sent to the running container when you want it to stop.

How do I stop docker?

To stop a container you use the docker stop command and pass the name of the container and the number of seconds before a container is killed. The default number of seconds the command will wait before the killing is 10 seconds.

How do I stop docker from running in the background Mac?

As of today's latest version you can stop DOCKER Desktop App by clicking the "ship" symbol in the top panel and then hit "Quit Docker Desktop" !


2 Answers

The docker desktop app starts a qemu vm, so the desktop app has no control over the PIDs. To oversome 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.)

like image 183
Hannes Stoolmann Avatar answered Sep 16 '22 19:09

Hannes Stoolmann


You can open the Activy Monitor, select Docker and then use the Quit button.

Maybe you will need to use the Force Quit option.

enter image description here

like image 35
valdeci Avatar answered Sep 17 '22 19:09

valdeci