Last active
February 15, 2016 16:43
-
-
Save degnome/2adeb7c8189f8ba66151 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
##### Constants | |
MACHINE_NAME=private-cloud | |
# DOCKER_REPO= | |
# DOCKER_REPO2= | |
# DOCKER_USER= | |
# DOCKER_PWD= | |
# DOCKER_EMAIL= | |
##### Functions | |
function show_help | |
{ | |
echo "Command line Options" | |
echo " --create" | |
echo " --destroy" | |
echo " --start" | |
} | |
function create | |
{ | |
if [[ ${DOCKER_REPO} && ${DOCKER_REPO2} ]] | |
then | |
echo 'Two Insecure Registries' | |
eval docker-machine create \ | |
--driver virtualbox \ | |
--engine-insecure-registry $DOCKER_REPO \ | |
--engine-insecure-registry $DOCKER_REPO2 \ | |
$MACHINE_NAME | |
eval docker-machine ssh $MACHINE_NAME 'docker login -u $DOCKER_USER -p $DOCKER_PWD -e $DOCKER_EMAIL $DOCKER_REPO' | |
eval docker-machine ssh $MACHINE_NAME 'docker login -u $DOCKER_USER -p $DOCKER_PWD -e $DOCKER_EMAIL $DOCKER_REPO2' | |
elif [[ ${DOCKER_REPO} ]] | |
then | |
echo 'One Insecure Registry' | |
eval docker-machine create \ | |
--driver virtualbox \ | |
--engine-insecure-registry $DOCKER_REPO \ | |
$MACHINE_NAME | |
eval docker-machine ssh $MACHINE_NAME 'docker login -u $DOCKER_USER -p $DOCKER_PWD -e $DOCKER_EMAIL $DOCKER_REPO' | |
else | |
echo 'No Insecure Registry' | |
eval docker-machine create \ | |
--driver virtualbox \ | |
$MACHINE_NAME | |
fi | |
} | |
function start | |
{ | |
HOSTIP=${DOCKER_HOST:6:13} docker-compose -f docker-compose.yml up -d | |
} | |
function destroy | |
{ | |
eval docker-machine rm -f $MACHINE_NAME | |
} | |
##### Main | |
case "$1" in | |
--create) echo "Creating $MACHINE_NAME" | |
create | |
;; | |
--destroy) echo "Destroying $MACHINE_NAME" | |
destroy | |
;; | |
--start) echo "Starting Mesosphere and Marathon" | |
start | |
;; | |
*) show_help | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment