Created
May 19, 2023 12:45
-
-
Save softwaredoug/8bd8e3fcce98887ad6c2f5fe6c977f8e to your computer and use it in GitHub Desktop.
Put as 'docker-compose' and it will protect you from inadvertent `docker-compose down`
This file contains 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 | |
args=($@) | |
for i in "${!args[@]}"; do | |
arg=${args[$i]} | |
if [[ "$arg" = "down" ]];then | |
echo "Stopping instead of downing" | |
echo "Use 'docker-compose destroy' to destroy" | |
args[i]="stop" | |
echo "Running docker-compose ${args[@]}" | |
elif [[ "$arg" = "destroy" ]];then | |
args[i]="down" | |
echo "Running docker-compose ${args[@]}" | |
fi | |
done | |
/usr/local/bin/docker-compose ${args[@]} # Adapt to actual path to docker-compose binary if different |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment