Last active
August 29, 2015 14:15
-
-
Save vovanbo/ef41a027f9a6f29a5fc4 to your computer and use it in GitHub Desktop.
Local dockers with docker-compose
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 | |
PATH_TO_CONFIG='docker-compose.yml' | |
unamestr=$(uname) | |
cmd_prefix='sudo ' | |
if [ "${unamestr}" == "Darwin" ]; then | |
cmd_prefix='' | |
docker-machine ip dev | |
fi | |
dcexec="${cmd_prefix} docker-compose -f ${PATH_TO_CONFIG}" | |
is_dockers_created=$(${dcexec} ps -q) | |
if [ "$1" = 'start' ]; then | |
if [ -z "${is_dockers_created}" ]; then | |
${dcexec} up -d | |
else | |
${dcexec} start | |
fi | |
fi | |
if [ "$1" = 'stop' ]; then | |
${dcexec} stop | |
fi | |
if [ "$1" = 'clean' ]; then | |
${dcexec} stop && ${dcexec} rm --force | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment