Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save orangain/6964a62111e0dc3ff0d2 to your computer and use it in GitHub Desktop.
Save orangain/6964a62111e0dc3ff0d2 to your computer and use it in GitHub Desktop.
Mac OS X script to start Docker VM automatically on system boot

Setup

  1. Download com.docker.vm.plist and save it into ~/Library/LaunchAgents/.

    $ curl -sL https://git.io/vz2Y9 -o ~/Library/LaunchAgents/com.docker.vm.plist
    
  2. (Optional) Change <string>default</string> line if you are using different name of docker machine.

  3. Run:

    $ launchctl load ~/Library/LaunchAgents/com.docker.vm.plist
    
  4. (Optional) Add output of docker-machine env default into your .bash_profile.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>com.docker.vm</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/docker-machine</string>
<string>start</string>
<string>default</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/docker-vm.err.log</string>
<key>StandardOutPath</key>
<string>/usr/local/var/log/docker-vm.out.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment