Skip to content

Instantly share code, notes, and snippets.

@krak3n
Created July 25, 2014 14:32
Show Gist options
  • Save krak3n/0f7fe4c3c5828767ec5b to your computer and use it in GitHub Desktop.
Save krak3n/0f7fe4c3c5828767ec5b to your computer and use it in GitHub Desktop.
OSX boot2docker auto start & auto export DOCKER_HOST
# Add this to your bashrc or zshrc or whatever
port=`boot2docker info | awk -F=":" -v RS="," '$1~/"DockerPort"/ {print}' | sed 's/\"//g' | sed 's/DockerPort://'`
export DOCKER_HOST="tcp://:${port}"
<?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.boot2docker</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/boot2docker up</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/chrisreeves</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/boot2docker.err.log</string>
<key>StandardOutPath</key>
<string>/usr/local/var/log/boot2docker.out.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment