Restart Docker service from command line

Hello,

I am trying to stop, start and restart com.docker.service from Windows PowerShell as admin,

PS C:\Windows\system32> net stop com.docker.service
The Docker for Windows Service service is stopping.
A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

The Docker for Windows Service service was stopped successfully.

PS C:\Windows\system32> net start com.docker.service
The Docker for Windows Service service is starting.
The Docker for Windows Service service was started successfully.

PS C:\Windows\system32> docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error ma
y also indicate that the docker daemon is not running.
PS C:\Windows\system32>

Does anyone know the correct way to restart Docker as a service on Windows 10? Thanks

1 Like

From powershell prompt following works for me with no issues

restart-service *docker*

1 Like

If you’re using Docker for Windows, that comes with it’s own restart and reset in the gui:

What’s going wrong that requires restarts?

2 Likes

Hi Michael (@friism),

What GUI is this in your screenshot? I’m using docker for windows. I don’t seem to have this GUI anywhere.

Thanks!

1 Like

After you right clicking docker’s icon in task bar. you’ll see ‘setting’ item in list. it would be open that GUI.

image

When I installed, I got the “Docker Quickstart Terminal”.

You can use this to start/restart.

Docker Quickstart Terminal comes with Docker Toolbox. Docker toolbox is for older PCs , the latest ones need “Docker for windows” which does not have the Docker Quickstart Terminal. Also, the services show that docker is running, and so does “net start com.docker.service”. But still there is the following error while running docker commands:
“error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.32/images/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.”

I don’t have GUI but I use Docker QuickStart Terminal and

docker-machine restart

helps

2 Likes

following. let me know if this is resolved, I am also facing same problem since one month. Not able to fix it till today.

I am using Windows 10 Pro N 1803 VM running in Azure. After I restarted com.docker.service, I got the exactly same error message. I tried to use Docker GUI to restart docker, but it doesn’t help. Finally I figured out there are 2 ways to get back Docker to normal.

Solutions
#1 Use Docker GUI to quit docker first; then just run “Docker for Windows.exe”.
#2 Use Docker GUI to reset docker.

Is there possible I can call quit or reset docker from Command Line? I am being blocked for 2 weeks, your help is much appreciated.

1 Like

I would dearly love to know if anybody figured out a way to do this. I’m perfectly able to “restart-service com.docker.service”, or “net stop com.docker.service” and “net start com.docker.service”. However, doing this never ever results in a usable docker again until doing a restart from the gui.

I note that using the services app results in the same behavior. If you stop “Docker desktop” there and then start it again, you end up with broken docker. Permanently. Although the gui widget is still running and says everything is fine.

I use Windows containers for my development efforts.
I just updated to 2.0.0.3 and hit the same issue.

How I solved it
First I had to delete the “daemon.json” file in “C:\ProgramData\Docker\config” - it seems to have been corrupted by the update. Don’t even try to set ACLs on that file.
Then, I opened the “Docker of Windows” UI from the system tray and I switched to Linux containers.
This will start the MobyLinuxVM in your local Hyper-V.
Check the status of the Docker startup in the “Docker of Windows” UI - it will go from orange to green.
Once the switch-over is done, switch back to Windows containers.
After the running status is green again, do a “docker version” from the command line and you should be golden.

Remember to stop the MobyLinuxVM in your Hyper-V manager.

See my reply on stackoverflow : https://stackoverflow.com/a/55212066/318673

thanks, this is the correct answer

Just created an acount to login and thank you mate.

I´m solved this problem just making a logout and a login into docker desktop.

1 Like

this worked for me. after relogin and restart it works.

Following article explains the issue and solution in details

Restarting The Docker Service From The Command Line On Windows

Hello Michael GUI, simply means General User Interface, if you are using docker desktop, just go to settings and a change maybe the light, then you will seen two buttons by your right down corner click on Apply & restart.