Skip to content

Instantly share code, notes, and snippets.

@tonydspaniard
Created October 4, 2020 16:38
Show Gist options
  • Save tonydspaniard/6f88891eaaa23183fcb6cf1249860649 to your computer and use it in GitHub Desktop.
Save tonydspaniard/6f88891eaaa23183fcb6cf1249860649 to your computer and use it in GitHub Desktop.
Docker + Mutagen for MacOSX
#!/usr/bin/env bash
COMPOSE="docker-compose -f docker-compose.yml" # -f docker-compose-override.yml
if [ $# -gt 0 ]; then
if [ "$1" = "up" ]; then
shift 1
$COMPOSE up "$@" -d --build
mutagen sync terminate {SERVICE NAME} # this will display a warning if wasn't created before, but will run
mutagen sync create \
--name={SERVICE NAME} \
--ignore=logs \
$(pwd) docker://root@{YOUR IMAGE NAME}/{YOUR PATH IN THE IMAGE}
elif [ "$1" = "down" ]; then
mutagen sync terminate {SERVICE NAME}
$COMPOSE down --remove-orphans
elif [ "$1" = "start" ]; then
shift 1
$COMPOSE start "$@"
mutagen sync terminate {SERVICE NAME} # this will display a warning if wasn't created before, but will run
mutagen sync create \
--ignore=logs \
--name={SERVICE NAME} \
$(pwd) docker://root@{YOUR IMAGE NAME}/{YOUR PATH IN THE IMAGE}
elif [ "$1" = "stop" ]; then
mutagen sync terminate {SERVICE NAME}
$COMPOSE stop
fi
fi
@tonydspaniard
Copy link
Author

Usage

./mutadocker up|down|start|stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment