How to restart docker for windows using Powershell?

0 votes
I’m trying to restart docker for windows in Powershell. But when I do Restart-Service *docker*:

I get a CloseError.

Is there a solution to this?
Oct 23, 2018 in DevOps & Agile by Sophie may
• 9,870 points
308 views

1 answer to this question.

0 votes

Try this:

$processes = Get-Process "*docker for windows*"
if ($processes.Count -gt 0)
{
    $processes[0].Kill()
    $processes[0].WaitForExit()
}
Start-Process "C:\Program Files\Docker\Docker\Docker for Windows.exe"

There should never be more than 1 instance of "Docker for Windows" running so you can then kill the first one in the list.

To restart you need to know the full path of the "Docker for Windows.exe" file on your computer.

answered Oct 23, 2018 by Tyrion anex
• 8,280 points

Related Questions In DevOps & Agile

0 votes
1 answer
0 votes
1 answer
+1 vote
3 answers
0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 29, 2018 in DevOps & Agile by Tyrion anex
• 8,280 points
127 views