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,050 points
76 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
73 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.