# Restart Docker from command line

**URL:** <https://forums.docker.com/t/restart-docker-from-command-line/9420>\
**Category:** Docker Desktop\
**Tags:** macos\
**Created:** [April 18, 2016, 1:34pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420 "2016-04-18T13:34:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![subfuzion](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/subfuzion/32/4410_2.png) [@subfuzion](https://forums.docker.com/u/subfuzion)\
**Post date:** [April 18, 2016, 1:34pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/1 "2016-04-18T13:34:17Z")

</div>

What’s the correct way to restart Docker for the Docker for Mac beta from the command line?

---

<div class="post-metadata">

**Author:** ![davetucker](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/davetucker/32/9374_2.png) [@davetucker](https://forums.docker.com/u/davetucker)\
**Post date:** [April 18, 2016, 5:00pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/2 "2016-04-18T17:00:58Z")

</div>

There isn’t a supported way to do this from the command line right now. The best way is to Quit and Re-Open Docker for Mac. There is a `pinata restart` command but it’s for troubleshooting only and will likely disappear in a future beta.

Thanks for trying out Docker for Mac!

---

<div class="post-metadata">

**Author:** ![subfuzion](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/subfuzion/32/4410_2.png) [@subfuzion](https://forums.docker.com/u/subfuzion)\
**Post date:** [April 18, 2016, 11:37pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/3 "2016-04-18T23:37:19Z")

</div>

Thanks for the feedback. Good to know about the `pinata restart` command for the interim. I hope consideration is given to providing official support to start/stop/restart from the command line.

---

<div class="post-metadata">

**Author:** ![derimagia](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/derimagia/32/7447_2.png) [@derimagia](https://forums.docker.com/u/derimagia)\
**Post date:** [July 8, 2016, 1:54am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/4 "2016-07-08T01:54:14Z")

</div>

Would also love some official ways to start/stop the service. I was going to update [https://github.com/matryer/bitbar-plugins/blob/e3ebf9ec6f941d29646dff9fe0c6bc6af8f57a56/Dev/Docker/docker-status.1m.sh](https://github.com/matryer/bitbar-plugins/blob/e3ebf9ec6f941d29646dff9fe0c6bc6af8f57a56/Dev/Docker/docker-status.1m.sh) (Bitbar plugin to show containers for docker) but I don’t see official ways documented anywhere.

I found “launchctl start com.docker.helper” to start the service and I’m sure I can find other ways to do it by debugging the process but it would be nice if this was officially documented somewhere.

---

<div class="post-metadata">

**Author:** ![jforssell](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jforssell](https://forums.docker.com/u/jforssell)\
**Post date:** [November 29, 2016, 9:21am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/6 "2016-11-29T09:21:35Z")

</div>

I’ve found that a simple

> `killall com.docker.osx.hyperkit.linux `

will do the trick on macOS.

---

<div class="post-metadata">

**Author:** ![wilon](https://avatars.discourse-cdn.com/v4/letter/w/ce73a5/32.png) [@wilon](https://forums.docker.com/u/wilon)\
**Post date:** [September 7, 2017, 6:07am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/7 "2017-09-07T06:07:27Z")

</div>

Kill the app and reopen it. Is the same of **restart**

```
killall Docker && open /Applications/Docker.app
```

---

<div class="post-metadata">

**Author:** ![barryallard](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/barryallard/32/17152_2.png) [@barryallard](https://forums.docker.com/u/barryallard)\
**Post date:** [September 9, 2017, 3:31am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/8 "2017-09-09T03:31:56Z")

</div>

## How to control Docker for Mac from the CLI

### Stop Docker for Mac gracefully

```
test -z "$(docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"'

```

**Note:** Requires all Docker containers in the stopped state

* * *

### Stop all Docker containers without confirmation (dangerous if running something)

```
docker ps -q | xargs -L1 docker stop

```

**Note:** Assumes all running Docker containers are in a quiesced state

* * *

### Start Docker gracefully

```
open --background -a Docker

```

**Note:** It may take up to a minute for Docker to fully start

---

<div class="post-metadata">

**Author:** ![deiwin](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/deiwin/32/19313_2.png) [@deiwin](https://forums.docker.com/u/deiwin)\
**Post date:** [March 22, 2018, 3:35pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/9 "2018-03-22T15:35:50Z")

</div>

> **Note** : It may take up to a minute for Docker to fully start

I used the following snippet to deal with the issue of knowing when docker is ready to take commands:

```auto
while ! docker system info > /dev/null 2>&1; do sleep 1; done

```

So e.g.:

```auto
open --background -a Docker &&
  while ! docker system info > /dev/null 2>&1; do sleep 1; done &&
  docker run busybox

```

---

<div class="post-metadata">

**Author:** ![flasheridn](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/flasheridn/32/25413_2.png) [@flasheridn](https://forums.docker.com/u/flasheridn)\
**Post date:** [October 22, 2019, 9:15pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/10 "2019-10-22T21:15:32Z")

</div>

That won’t work on a machine which hasn’t logged into the Mac GUI:

`LSOpenURLsWithRole() failed for the application /Applications/Docker.app with error -610.`

---

<div class="post-metadata">

**Author:** ![marxluo](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@marxluo](https://forums.docker.com/u/marxluo)\
**Post date:** [October 30, 2019, 6:43am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/11 "2019-10-30T06:43:27Z")

</div>

launchctl show docker server, remand docker server name

```auto
launchctl list | grep docker

111117 0 com.docker.docker.2388

```

then stop and start it

```auto
launchctl stop com.docker.docker.2388 && launchctl start com.docker.docker.2388

```

---

<div class="post-metadata">

**Author:** ![rtjmobej999](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@rtjmobej999](https://forums.docker.com/u/rtjmobej999)\
**Post date:** [January 19, 2020, 8:21pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/12 "2020-01-19T20:21:55Z")

</div>

Were you using iTerm2 when you got that error? - I recall getting pretty much the same error shortly after bootstrapping a new Mac on Mojave, and attempting to launch a dashboard from the command-line in iTerm2 ( error -600 in my case…). When a simple test with `open http://github.com`threw exactly the same error, but then worked fine in the Terminal app, it was a pretty short trip to Security & Privacy --\> Privacy --\> adding iTerm2 to “Full Disk Access”, and resolution. Anyway, as mentioned by others in this thread, while it’s more pull than push, using the built-in Terminal app to curl the Github API, and scripts that perhaps leverage some combination of `sudo -v`/`sudo -n`, `osascript -e` and establishing some gating with a few while loops conditioned on`sleep 1;`, etc. seem like pretty good ideas 🙂

---

<div class="post-metadata">

**Author:** ![jmorcar](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@jmorcar](https://forums.docker.com/u/jmorcar)\
**Post date:** [October 13, 2020, 8:02pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/13 "2020-10-13T20:02:04Z")

</div>

Is there any update to start docker for mac like a daemon on boot without user login ?

---

<div class="post-metadata">

**Author:** ![kbantom23](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kbantom23](https://forums.docker.com/u/kbantom23)\
**Post date:** [July 24, 2021, 3:48pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/14 "2021-07-24T15:48:51Z")

</div>

Thanks, this worked for me!

---

<div class="post-metadata">

**Author:** ![ssuryawanshi](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@ssuryawanshi](https://forums.docker.com/u/ssuryawanshi)\
**Post date:** [November 30, 2021, 9:40am UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/15 "2021-11-30T09:40:50Z")

</div>

This works fine for Pro CML docker start.

---

<div class="post-metadata">

**Author:** ![chibrady03](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/chibrady03/32/33058_2.png) [@chibrady03](https://forums.docker.com/u/chibrady03)\
**Post date:** [June 9, 2022, 8:45pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/16 "2022-06-09T20:45:41Z")

</div>

FYI, on Apple Silicon, the GUI does this:

```bash
curl -X POST -H 'Content-Type: application/json' -d '{ "openContainerView": true }' -kiv --unix-socket ~/Library/Containers/com.docker.docker/Data/backend.sock http://localhost/engine/restart

```

---

<div class="post-metadata">

**Author:** ![masterchief542](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/masterchief542/32/32675_2.png) [@masterchief542](https://forums.docker.com/u/masterchief542)\
**Post date:** [December 7, 2022, 1:28pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/17 "2022-12-07T13:28:51Z")

</div>

I am looking for the very same thing.

There has to be a way to start a daemon without requiring any GUI.

Please - anyone from docker over here?

Just trying to standardize operational procedures all across (ubuntu/debian, redhat/centos, windows & macos…).

THANKS!

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [December 7, 2022, 9:42pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/18 "2022-12-07T21:42:16Z")

</div>

> [@masterchief542](#):
>
> There has to be a way to start a daemon without requiring any GUI.

Docker Desktop is more than just a daemon. The Docker daemon itself runs in a virtual machine and not even directly in the virtual machine but in a containerd container. I actually entered that container in my presentation at `Docker Community All-Hands #6`. You can find a blogpost based on that with the link to the video here:

> **[How to Fix and Debug Docker Containers Like a Superhero | Docker](https://www.docker.com/blog/how-to-fix-and-debug-docker-containers-like-a-superhero/)**
>
> Container errors are tricky to diagnose, but some investigative magic works wonders. Read along to learn how to debug Docker containers.

Docker Desktop was meant to be a developer tool and not a server that we control from the terminal except that we can obviously use the Docker client from the host but that connects to the remote daemom inside the virtual machine.

As you, I like to use the terminal too and control things from scripts sometimes. but I have never needed it for Docker Desktop. If you feel you need it, you can ask for it in the roadmap. I don’t think there is an easy way today.

> **[GitHub - docker/roadmap: Welcome to the Public Roadmap for All Things Docker!...](https://github.com/docker/roadmap)**
>
> Welcome to the Public Roadmap for All Things Docker! We welcome your ideas. - GitHub - docker/roadmap: Welcome to the Public Roadmap for All Things Docker! We welcome your ideas.

> [@masterchief542](#):
>
> Just trying to standardize operational procedures all across (ubuntu/debian, redhat/centos, windows & macos…).

Docker, Inc tries to give us a unified way to use Docker Desktop, but every operating system is different so there have to be differences. I think it is hard enough to maintain it and keep it stable on each platform so it could be one of the reasons why we don’t have a way to control the virtual machines from terminal yet. Even if we had a way, Docker Desktoo would still be different, since that feature would most likely not be implemented in the docker client, but as a separate cli application. If you use only Docker Desktop, that could work, but there are some features that you can’t use with Docker Desktop. And we are back to the beginning that Docker Desktop was created to be a Developer tool and the fact that it uses virtual machines (it has to) makes it unsuitable for some tasks.

I hope I could clear some things up, but feel free to share your ideas in the roadmap 🙂 .

---

<div class="post-metadata">

**Author:** ![masterchief542](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/masterchief542/32/32675_2.png) [@masterchief542](https://forums.docker.com/u/masterchief542)\
**Post date:** [December 19, 2022, 3:00pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/19 "2022-12-19T15:00:26Z")

</div>

Hi everyone,

I do get it that the Docker Desktop is more than an engine - but I do not believe I need the “more” (personally). Hence my question.

Could it be possible to start the daemon each time I start my Mac without having to start the whole desktop application?

THANKS!

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [December 19, 2022, 11:58pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/20 "2022-12-19T23:58:25Z")

</div>

There is an option in the General preferences

![Screenshot 2022-12-20 at 0.56.44](https://global.discourse-cdn.com/docker/original/3X/a/9/a9b518a1d96a3657c7fa80067e15a57763ac812e.png)

“Open Docker Dashboard at startup”

You can disable it so the virtual machine with the Docker Daemon inside would start but not the graphical interface.

To be honest, I haven’t tried that since my desktop doesn’t start automatically at all. So I guess the dashboard will not pop up, but the icon at the top of the screen would be still there so you can stop the desktop when you don’t need it.

---

<div class="post-metadata">

**Author:** ![ryanpringnitz](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ryanpringnitz/32/35940_2.png) [@ryanpringnitz](https://forums.docker.com/u/ryanpringnitz)\
**Post date:** [December 29, 2022, 2:12pm UTC](https://forums.docker.com/t/restart-docker-from-command-line/9420/22 "2022-12-29T14:12:25Z")

</div>

Would love this functionality.

Any version higher than 4.12 hangs when launched. This issue was avoided by disabling auto-update on the Docker client. Now I just started stumbling into a memory leak on 4.12, and am testing different solutions (e.g. restarting the Docker client when memory usage exceeds $x). This issue is observed on a MacBook Pro w/ Intel chipset (tested with macOS Monterey & Ventura).

[Next page](https://forums.docker.com/t/restart-docker-from-command-line/9420.md?page=2)
