Skip to content

Instantly share code, notes, and snippets.

@vovanbo
Last active August 29, 2015 14:15
Show Gist options
  • Save vovanbo/ef41a027f9a6f29a5fc4 to your computer and use it in GitHub Desktop.
Save vovanbo/ef41a027f9a6f29a5fc4 to your computer and use it in GitHub Desktop.
Local dockers with docker-compose
#!/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