Skip to content

Instantly share code, notes, and snippets.

@ThatLurker
Last active September 12, 2020 18:48
Show Gist options
  • Save ThatLurker/e61ea558a70e30ee5de934754e8931bd to your computer and use it in GitHub Desktop.
Save ThatLurker/e61ea558a70e30ee5de934754e8931bd to your computer and use it in GitHub Desktop.
Docker-Compose update script
#!/bin/bash
confirm() {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120
echo "Pulling latest contrainer images" && docker-compose pull && echo "Recreating updated contrainers" && docker-compose up -d && echo "Current docker disk usage" && docker system df && confirm "Would you like to prune dangling images? [y/N]" && docker system prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment