26

Is there a way to start Docker for Mac (and / or Docker for Windows) from the command line? I can't find any documentation about it.

My team uses a set of scripts to automate setup of our development environment using docker-machine. Some of us have been testing Docker for Mac and like it, but we don't like having to start a separate app before switching back to the command line.

7
  • Sometime along the way it seemingly was launchctl start local.dlite (reference). Now I have com.docker.helper and com.docker.docker running, but cannot locate their plist files.
    – techraf
    Commented Jul 26, 2016 at 4:45
  • What part of Docker are you looking to start? The daemon? The VM hosting the actual docker container should start automatically, IIRC.
    – Daniel B
    Commented Jul 26, 2016 at 5:28
  • I'm not sure about Windows, but for me the daemon and VM both run automatically at boot or login (not sure which) on Mac.
    – Dan Lowe
    Commented Jul 26, 2016 at 5:50
  • @DanielB Here under Preferences it shows it runs on user login, the machine shouldn't be started if you SSHed to a booted machine without logging on the console.
    – techraf
    Commented Jul 26, 2016 at 6:55
  • 1
    Have you found any solution for starting Docker for Mac from the command line?
    – Martin
    Commented Feb 9, 2017 at 7:37

1 Answer 1

22

You can open Docker for Mac from the terminal using:

open -a Docker

I'm using the first production version of Docker for Mac (1.12) that came out last week. You can also have it autostart under Preferences.

4
  • 12
    I'm using open --hide --background -a Docker to start Docker. The --hide makes it not splurge its admittedly cute and cetacean-filled UI all over my screen, and --background stops the application getting the focus, leaving me to continue with docker commands in my console. If you wanted then to wait until the daemon is actually up, see stackoverflow.com/questions/5274294 for ideas.
    – tobych
    Commented May 11, 2017 at 22:26
  • 2
    Note that open -a Docker will return before the daemon is up and running. On my MacBook it takes just under 30 seconds to start up.
    – Alex S
    Commented May 9, 2018 at 23:48
  • I use this script to retry my first docker command until the daemon has started up successfuly: open --hide --background -a Docker; until docker build --tag rkibot .; do; sleep 1; done; Commented May 24, 2020 at 15:57
  • 2
    This is not working anymore. The GUI launches regardless.
    – nicbou
    Commented Nov 10, 2020 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .