Skip to content

Instantly share code, notes, and snippets.

@ezy
Created April 23, 2019 04:39
Show Gist options
  • Save ezy/909a7483ced69f8d71890843200c33fa to your computer and use it in GitHub Desktop.
Save ezy/909a7483ced69f8d71890843200c33fa to your computer and use it in GitHub Desktop.
Shell script to run multiple docker-compose files in a microservices folder structure
#!/usr/bin/env bash
directories=$(find . -mindepth 1 -maxdepth 1 -type d)
command=""
for d in $directories
do
file="$d/compose.yml"
if [ -f $file ];
then
command="$command -f $file"
fi
done
command="docker-compose -f docker-compose.yml $command $@"
echo $command
eval $command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment