Stopping docker host on windows using task manager or command prompt

I want to stop docker host by using either task manager or command prompt and it should also free up the resource it holds…if I kill the process it’s not free up all the resources as like the quit docker on the notification icon does

1 Like

Is this for Docker for Windows? If you exit the app, it should free up most resources.

Thks michael

Yes it’s docker for windows…if I manually quit,all the resources are released.But I have to stop the process using taskmanager, while doing so it’s not releasing all the memory it holds(in my case I have alloted 4gb to run docker)…Is it possible to quit docker either by taskmanager or by using cmd…

Why can’t you use the tray menu to quit?

It is possible to do this on the server versions, but not in the Docker for Windows version.

The command to stop the docker service in powershell is stop-service docker — I just tested this by stopping the service and watching the resource monitor here on a test server. It does appear to release everything, including CPU and memory.

Thanks,
Jason

It’s there Michael ,but I want to stop programmatically…is there any way for that??

Thanks Jason…

I want that to be achieved in Docker CE…

We want the bat to stop the Docker from background process in Windows 10.

This is not possible - what’s your use case?

Hi Michael,
In our case docker should automatically start and stop based on the available physical memory…There will be batch that will check for the available memory continuously and it should start and stop docker automatically…Is there any workaround to achieve that

Hi, My use case is that the docker’s taskbar menu is broken and can’t be interacted with, and I need to restart docker without restarting my entire machine. Is there something I can do?

You can stop the machine using this

This will give you the name of the machine

docker-machine ls

You can then stop the machine

docker-machine stop machine-name

Doc Link

A little confusing, not able to stop with Powershell, but using services.msc no issue:

stop-service com.docker.service
stop-service : Service 'Docker Desktop Service (com.docker.service)' cannot be stopped due to the following error:
Cannot open com.docker.service service on computer '.'.
At line:1 char:2
+  stop-service com.docker.service
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStopService,Microsoft.PowerShell.Commands.StopServiceCommand

After stopping Docker Desktop service, still seeing “Vmmem” service munching away to the tune of 3GB of memory, using 3-5% CPU; I would expect that service to start winding down after terminating Docker Desktop. I like the GUI that DD provides, but prefer the much lighter footprint of docker installed on Linux. Call me old school, most of my Docker builds are done with WSL2 with a Windows mount (/mnt/c/users/me/dev), giving me a certain amount of “interop” but any RAM south of 16GB doesn’t seem to be a great way to run Docker under Windows.

Check out vmmen process consuming too much memory (Docker Desktop) - DEV Community looks like Windows is still the “red headed stepchild” for Docker fans.

1 Like

Considering that Docker is an orchestrator/glue for Linux kernel modules and tools, it can only be a first class citizen on Linux… Docker for Desktop always runs a Linux VM (or at least a wsl2 container) under the hood and has to wire the hosts docker cli commands to the Linux VM - which kind of feels half-as*ed in some areas.

If WSL2 is used, after closing DfD, it might be worth trying to execute wsl shutdown, which stops the “WSL2 VM” and with it all the WSL2 distributions that run in seperate containers. Though, you can also just terminate the distribution wsl -t ${distribution} that runs the docker engine.

I personaly rather run docker in a self managed vm then use Docker for Desktop. Its true that DfD is very convinient, but I am a strong believer that from development to production the plattform and version should be identical, which is not entirely true with DfD - except if someone is crazy enough to run his/her productive workload with DfD as well.

What I wrote is only true for running Linux containers and completly ignores Windows containers.

All points well taken. I find that WSL2 by itself (maybe WSLg when it is fully baked, will include xorg binaries) is a pretty good dev environment for Linux server apps such as Django/Python, and a good way to get familiar with all the command line xNIX tools (sed, awk, nginx, apache) without a huge memory footprint. Given a 1TB SSD and a 16G RAM playpen, I have plenty of CPU and RAM overhead, and can fire up DfD when everything is running to my satisfaction, push to the cloud, and pull it back on an external SSD running full Ubuntu 20.04. I have found Docker to be an amazing cloud environment; it is simple and reliable (Azure and AWS probably claim to have the “reliable” part covered) way to do cross-platform development!

Anyone who have found a solution to this problem. I am also getting
Cannot open com.docker.service service on computer
BR
Patrik

I have the same problem for Windows 10 Pro version. Whan Docker worked I can’t work with ports that using Docker… How to fix this problem ? For what you create Button that dosen’t shut down the Docker ?

Hi everybody,

I’m using this function in powershell to stop docker! I can also use it as an alias.

Function DockerStop {
  Stop-Process -Name 'Docker Desktop' 
  Stop-Process -Name com.docker.backend
} 

Set-Alias docker_stop -Value DockerStop
1 Like