Skip to content

Instantly share code, notes, and snippets.

@bhgraham
Created December 31, 2014 01:57
Show Gist options
  • Save bhgraham/9dced0918dc20edd1484 to your computer and use it in GitHub Desktop.
Save bhgraham/9dced0918dc20edd1484 to your computer and use it in GitHub Desktop.
Quick Install for Docker on Mac OSX
# Quick Install for Docker on Mac OSX
# Author: Benjamin H. Graham <bman@bman.io>
# Must be run as root
# Usage: curl -s bman.io/i/install_dockermac|sudo bash
cd ~
echo "Downloading docker binary";
curl -Ls "https://github.com/boot2docker/osx-installer/releases/download/v1.2.0/Boot2Docker-1.2.0.pkg" -o "Boot2Docker-1.2.0.pkg";
echo "Installing docker service";
installer -pkg Boot2Docker-1.2.0.pkg -target /;
echo "Cleaning up downloaded files";
#rm Boot2Docker-1.2.0.pkg;
echo "Initializing docker";
boot2docker init;
echo "Configuring Docker VM to run at startup";
mkdir -p /System/Library/StartupItems/docker;
echo "boot2docker start" > /System/Library/StartupItems/docker-start;
chmod +x /System/Library/StartupItems/docker/docker-start;
echo "export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375" >> /etc/profile;
# start it up now and test it out
echo "Starting docker...";
boot2docker start;
echo "Testing docker with hello-world";
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375;
docker run hello-world;
echo "You should see a hello world message above.";
echo "You will need to logout and back in to use docker. Otherwise run this: ";
echo "DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment