Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guidoschmidt/475c2e5c033b8d7732e0 to your computer and use it in GitHub Desktop.
Save guidoschmidt/475c2e5c033b8d7732e0 to your computer and use it in GitHub Desktop.
run docker-machine on system startup - Mac OSX - El Capitan
<?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>Label</key>
<string>com.docker.docker-machine</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/docker-machine</string>
<string>start</string>
<string>docker-vm</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>

Add to .zshrc or .bashrc so the environment settings are loaded (DOCKER_HOST, etc.)

eval "$(docker-machine env docker-vm)"

Note you don't need to give the .plist file 'root' ownership, as scripts inside ~/Library/LaunchAgents are under 'user' ownership.

setup

cp com.docker.docker-machine.plist ~/Library/LaunchAgents
launchctl load com.docker.docker-machine.plist

start deliberately

launchctl start com.docker.docker-machine.plist

check running

docker-machine ls

uninstall

launchctl unload com.docker.docker-machine.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment