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
• 10,620 points
7,523 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,700 points

Related Questions In DevOps & Agile

0 votes
1 answer
+2 votes
1 answer
0 votes
2 answers
+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 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
1,216 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP