Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created July 25, 2023 13:31
Show Gist options
  • Save Bouni/b049d21bfa9b35263e62c7a963e25fc2 to your computer and use it in GitHub Desktop.
Save Bouni/b049d21bfa9b35263e62c7a963e25fc2 to your computer and use it in GitHub Desktop.
A shell script to handle mutiple docker-compose files easily
#!/bin/sh
case $1 in
"update" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') pull --ignore-pull-failures && \
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') up -d;;
"status" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') ps -a;;
"lf" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') logs -f ${@:2};;
"clean" )
docker system prune --volumes;;
*)
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') $*;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment