Skip to content
Go back

Restart Docker for Mac Command

Published:  at  03:23 PM
1 min read

Docker for Mac is the best way to get started with Docker on a Mac.

Though some versions have a restart button in the dropdown menu, I was looking for a command to restart the service from the terminal.

Docker for Mac dropdown menu

Today I learned how to do it with a combination of two simple commands.

As Docker for Mac is a Mac OS GUI app we can use osascript[1] command to gracefully quit it:

$ osascript -e 'quit app "Docker"'

To start the app:

$ open -a Docker

Pro Tip

Add it as an alias in your .zshrc / .bashrc:

alias docker_restart="osascript -e 'quit app \"Docker\"' && open -a Docker"

[1] Read more about osascript




Previous Post
Search Code Like a Boss
Next Post
Migrate Global Packages