How do I restart Docker for Mac from the terminal?

rouan picture rouan · Oct 17, 2016 · Viewed 42.9k times · Source

Docker for Mac has a neat little 'restart' button in the dropdown from the whale icon in the menu bar.

I'd like to be able to restart Docker for Mac from the terminal, though. What command would I need to run?

Answer

BrDaHa picture BrDaHa · Jun 14, 2017

Specifically for Docker for Mac, because it's a "GUI" app, there's a workaround:

osascript -e 'quit app "Docker"'

Since you'd want to restart, here's the way to open it from the command line:

open -a Docker

There's probably a more symmetrical command to open using osascript, but the open command seems more common than the osascript one.