Created
January 8, 2015 07:53
-
-
Save ricp/9ae6a79ed6869ce07177 to your computer and use it in GitHub Desktop.
Boot2Docker install script for OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ------- Docker OSX installer ------- # | |
# | |
# richard.piacentini@nuxos.asia - 2015/01/08 | |
# | |
if [ $# -eq 0 ] | |
then | |
echo " | |
*** WARNING: this script must be run with sudo | |
Usage: | |
sudo $0 <Docker Version> | |
Example: | |
sudo $0 1.4.1" | |
exit | |
fi | |
current_version=$1 | |
download_dir=~/docker_releases | |
# --- DO NOT EDIT AFTER THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING... | |
function docker_install { | |
echo "Installing docker service for version: ${current_version}" | |
echo "Boot2docker must be stopped before install" | |
docker_stop | |
installer -pkg "${download_dir}/Boot2Docker-${current_version}.pkg" -target / | |
} | |
function docker_download { | |
url="https://github.com/boot2docker/osx-installer/releases/download/v${current_version}/Boot2Docker-${current_version}.pkg" | |
echo "Downloading docker binary version: ${current_version}" | |
echo "From: ${url}" | |
echo "To: ${download_dir}" | |
curl -L ${url} -o "${download_dir}/Boot2Docker-${current_version}.pkg" | |
} | |
function docker_init { | |
echo "Initializing docker" | |
boot2docker init 2> /dev/null | |
} | |
function docker_start { | |
echo "Starting docker" | |
docker_version | |
boot2docker up 2> /dev/null | |
docker_status; docker_ip | |
echo "Boot2Docker ip: ${ip} - status: ${status}" | |
} | |
function docker_stop { | |
echo "Stopping docker" | |
boot2docker down 2> /dev/null | |
docker_status; echo "Boot2Docker status: ${status}" | |
} | |
function docker_version { | |
boot2docker version 2> /dev/null | |
} | |
function docker_status { | |
status=$(boot2docker status) 2> /dev/null | |
} | |
function docker_ip() { | |
ip=$(boot2docker ip) 2> /dev/null | |
} | |
function create_download_dir { | |
mkdir -p ${download_dir} | |
} | |
# ------- End functions ------- # | |
# Run baby, run ! :-) | |
create_download_dir; | |
#docker_download; docker_install | |
docker_init; docker_start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment