Skip to content

Instantly share code, notes, and snippets.

@botchagalupe
Forked from nerdalert/gistify991303.sh
Last active August 29, 2015 14:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save botchagalupe/ebf037f0675d110c7240 to your computer and use it in GitHub Desktop.
Save botchagalupe/ebf037f0675d110c7240 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Must have boot2docker installed if using Mac OS X
installMachineMac() {
sudo wget --no-check-certificate -O /usr/local/bin/docker-machine http://docker-machine-builds.evanhazlett.com/latest/docker-machine_darwin_amd64
sudo chmod +x /usr/local/bin/docker-machine
}
installDockerBinMac(){
sudo wget --no-check-certificate -O /usr/local/bin/docker https://get.docker.com/builds/Darwin/x86_64/docker-latest
sudo chmod +x /usr/local/bin/docker
}
installCompose(){
sudo wget --no-check-certificate https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m`
sudo mv docker-compose-`uname -s`-`uname -m` /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
}
linuxDeps(){
sudo apt-get update && sudo apt-get install -y wget curl
}
installDockerBinLinux(){
sudo wget --no-check-certificate -qO- https://get.docker.com/ | sh
sudo usermod -aG docker `whoami`
}
# Installing case nightly build from a maintainer Evan
installMachineLinux() {
sudo wget --no-check-certificate -O /usr/local/bin/docker-machine https://docker-machine-builds.evanhazlett.com/latest/docker-machine_linux_amd64
sudo chmod +x /usr/local/bin/docker-machine
}
UNAME=$(uname)
if [ "$UNAME" = "Darwin" ]; then
# Mac OS X platform
echo "-----> Mac OS X detected, checking dependencies"
if [ ! -f /usr/local/bin/boot2docker ]; then
echo "-----> Did not find boot2docker in /usr/local/bin/boot2docker, go to http://boot2docker.io to download and install it."
exit 1
fi
echo "Boot2docker is installed, now pulling Mac OS X binaries"
if [ ! -f /usr/local/bin/docker ]; then
echo "-----> Downloading Docker Binary CLI (ensure boot2docker is installed if OSX, this is only tested on a MAC)..."
installDockerBinMac
fi
if [ ! -f /usr/local/bin/docker-machine ]; then
echo "-----> Downloading Docker Machine CLI..."
installMachineMac
fi
if [ ! -f /usr/local/bin/docker-compose ]; then
echo "-----> Downloading Docker Compose..."
installCompose
fi
elif [ "$UNAME" = "Linux" ]; then
# Linux platform
echo "Linux detected, checking dependencies"
if [ ! -f /usr/bin/wget ]; then
echo "-----> Downloading Docker Binary CLI (ensure boot2docker is installed if OSX, this is only tested on a MAC)..."
linuxDeps
fi
echo "-----> Dependencies meet, now pulling Linux binaries"
if [ ! -f /usr/bin/docker ]; then
echo "-----> Downloading Docker Binary CLI (ensure boot2docker is installed if OSX, this is only tested on a MAC)..."
installDockerBinLinux
fi
if [ ! -f /usr/local/bin/docker-machine ]; then
echo "-----> Downloading Docker Machine CLI..."
installMachineLinux
fi
if [ ! -f /usr/local/bin/docker-compose ]; then
echo "-----> Downloading Docker Compose..."
installCompose
fi
else
echo "-----> Unknown OS: $UNAME"
exit 1
fi
echo "Verify you see a version for each binary below (docker, macine, compose)"
echo "Compose and Machine are development HEAD builds with latest patches/features"
echo "Docker version -----> " $(docker -v)
echo "Docker Machine version -----> " $(docker-machine -v)
echo "Docker Machine version -----> " $(docker-compose --version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment