Skip to content

Instantly share code, notes, and snippets.

@RaphaelAudet
Last active June 12, 2017 09:52
Show Gist options
  • Save RaphaelAudet/621ee163417a22962fe0b16717cb10c6 to your computer and use it in GitHub Desktop.
Save RaphaelAudet/621ee163417a22962fe0b16717cb10c6 to your computer and use it in GitHub Desktop.
CloudFoundry destroy apps and services onliners
# FIXME theses scripts dont really play well if the app or services names have spaces
# WARNING theses onlinerss are destructive, please dont copy/paste this without understanding what you are doing, k?
# alias to got to the cloud foundry bluemix test environment and remove all apps and all services with "example"
alias NukeBluemix="export CF_HOME=~/.cf/profiles/bluemix && \
cf apps | grep .eu-gb.mybluemix.net | awk '{print $1}' | xargs -n 1 cf d -f -r && \
cf s | grep example | awk '{print $1}' | xargs -n 1 cf ds -f"
# the same as above but for "example" services only
alias NukeBluemixServices="export CF_HOME=~/.cf/profiles/bluemix && cf s | grep example | awk '{print $1}' | xargs -n 1 cf ds -f"
# the same as above but for "travis" services only
alias NukeBluemixTravis='export CF_HOME=~/.cf/profiles/bluemix && cf s | grep travis | awk '\''{print }'\'' | xargs -n 1 cf ds -f'
@RaphaelAudet
Copy link
Author

and for docker

dockerNukeContainer='docker ps -a| grep -v CONTAINER | awk '\''{ print $1}'\'' | xargs -L 1 docker rm -f'
dockerNukeImages='docker images | grep -v REPOSITORY | awk '\''{ print $3}'\'' | xargs docker rmi -f'

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