Last active
December 15, 2020 18:22
-
-
Save mycargus/cadbf28c9c6f6c5b1f47b6b016a6baa6 to your computer and use it in GitHub Desktop.
Revisions
-
mycargus revised this gist
Dec 15, 2020 . 1 changed file with 32 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,47 +2,57 @@ # Purpose: reset docker environment # Argument (optional): all # # "docker-reset" will kill and remove all containers (except dinghy-http-proxy), # dangling images, and volumes. It won't remove networks. # # "docker-reset all" will do everything in 'docker-reset' and remove all # networks, too. # # Prerequisite: you'll need to install docker-clean: brew install docker-clean # # To use dinghy-http-proxy with docker for mac, follow these instructions: # https://github.com/codekitchen/dinghy-http-proxy#using-outside-of-dinghy # Kill and remove all docker containers (except for dinghy-http-proxy) function docker-kill-all-except-dinghy-http-proxy() { PROXY=$(docker ps | grep dinghy-http-proxy | awk '{print $1}') echo "Killing docker containers..." docker kill $(docker ps -q | grep -v $PROXY) &> /dev/null echo "Removing docker containers..." docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Kill and remove all docker containers function docker-kill-all() { echo "Killing and removing docker containers..." docker rm -fv $(docker ps -a -q) &> /dev/null } # Stop and remove all docker containers (except for dinghy-http-proxy) function docker-stop-all-except-dinghy-http-proxy() { PROXY=$(docker ps | grep dinghy-http-proxy | awk '{print $1}') echo "Stopping docker containers..." docker stop $(docker ps -q | grep -v $PROXY) &> /dev/null echo "Removing docker containers..." docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } function docker-reset() { run_all=$1 if [[ "${run_all}" == "all" ]]; then docker-kill-all-except-dinghy-http-proxy echo "Running docker-clean ..." docker-clean --containers --images --volumes --networks --log else docker-kill-all-except-dinghy-http-proxy echo "Running docker-clean ..." docker-clean --containers --images --volumes --log fi } # Purpose: Delete all containers and images related to the provided tag name # Example: `docker-nuke selenium node` will delete all containers and images related to "selenium" and "node" function docker-nuke() { args=("$@") docker ps -a | grep ${args[0]} | cut -d ' ' -f 1 | while read ID; do docker rm $ID; done; -
mycargus revised this gist
Dec 15, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -58,5 +58,5 @@ function docker-rmi-all() { # Example: Using virtualbox as the VM for dinghy's docker host sometimes causes image download # latency. Run this function in a separate shell window when that happens. function slap-virtualbox() { while true; do dinghy ssh echo "ಠ_ಠ slap"; done } -
mycargus revised this gist
Mar 7, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,11 +15,11 @@ function docker-reset() { if [[ "${run_all}" == "all" ]]; then docker-kill-all echo "Running docker-clean ..." docker-clean --containers --images --volumes --networks --log else docker-kill-all echo "Running docker-clean ..." docker-clean --containers --images --volumes --log fi } -
mycargus revised this gist
Mar 7, 2019 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,25 @@ # Purpose: reset docker environment # Argument (optional): all # # "docker-reset" will kill and remove all containers (except dinghy_http_proxy), # dangling images, and volumes. It won't remove networks. # # "docker-reset all" will do everything in 'docker-reset' and remove all # networks, too. # # Prerequisite: you'll need to install docker-clean: brew install docker-clean function docker-reset() { run_all=$1 if [[ "${run_all}" == "all" ]]; then docker-kill-all echo "Running docker-clean ..." docker-clean --containers --images --volumes --log else docker-stop-all echo "Running docker-clean --networks ..." docker-clean --containers --images --volumes --networks --log fi } -
mycargus revised this gist
May 7, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function docker-reset() { run_all=$1 if [[ "${run_all}" == "all" ]]; then docker-kill-all echo "Running docker-clean ..." docker-clean -
mycargus revised this gist
May 7, 2018 . 1 changed file with 27 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,24 @@ # Purpose: reset docker environment # Argument (optional): all # # "docker-reset" will stop and remove all containers (except dinghy_http_proxy) and custom networks # # "docker-reset all" will reset the docker environment to clean slate (you will lose *all* volumes and custom networks!) # # Note: you'll need to install docker-clean: brew install docker-clean function docker-reset() { run_all=$1 if [[ "${run_all} == "all" ]]; then docker-kill-all echo "Running docker-clean ..." docker-clean else docker-stop-all echo "Running docker-clean --networks ..." docker-clean --networks fi } # Purpose: Kill and remove all docker containers (except for dinghy_http_proxy) @@ -16,6 +30,15 @@ function docker-kill-all() { docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Purpose: Stop and remove all docker containers (except for dinghy_http_proxy) function docker-stop-all() { PROXY=$(docker ps | grep dinghy_http_proxy | awk '{print $1}') echo "Stopping docker containers..." docker stop $(docker ps -q | grep -v $PROXY) &> /dev/null echo "Removing docker containers..." docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Purpose: Delete all images related to the provided tag name # Example: `docker-nuke selenium` will delete all images whose tags contain the word "selenium" function docker-nuke() { -
mycargus revised this gist
Apr 25, 2017 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,12 @@ # Purpose: reset docker environment to clean slate (you will lose *all* volumes and custom networks!) # Note: you'll need to install docker-clean: brew install docker-clean function docker-reset() { docker-kill-all echo "Running docker-clean..." docker-clean } # Purpose: Kill and remove all docker containers (except for dinghy_http_proxy) function docker-kill-all() { PROXY=$(docker ps | grep dinghy_http_proxy | awk '{print $1}') @@ -8,14 +16,6 @@ function docker-kill-all() { docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Purpose: Delete all images related to the provided tag name # Example: `docker-nuke selenium` will delete all images whose tags contain the word "selenium" function docker-nuke() { -
mycargus revised this gist
Apr 25, 2017 . 1 changed file with 10 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,4 @@ # Purpose: Kill and remove all docker containers (except for dinghy_http_proxy) function docker-kill-all() { PROXY=$(docker ps | grep dinghy_http_proxy | awk '{print $1}') @@ -16,13 +8,22 @@ function docker-kill-all() { docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Purpose: reset docker environment to clean slate (you will lose *all* volumes and custom networks!) # Note: you'll need to install docker-clean: brew install docker-clean function docker-reset() { docker-kill-all echo "Running docker-clean..." docker-clean } # Purpose: Delete all images related to the provided tag name # Example: `docker-nuke selenium` will delete all images whose tags contain the word "selenium" function docker-nuke() { args=("$@") docker ps -a | grep ${args[0]} | cut -d ' ' -f 1 | while read ID; do docker rm $ID; done; docker images | grep ${args[0]} | tr -s " " | cut -d ' ' -f 3 | while read ID; do docker rmi $ID; done } # Purpose: Remove all images function docker-rmi-all() { docker rmi -f $(docker images -q) -
mycargus revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Purpose: Delete all images related to the provided tag name # Example: `docker-nuke selenium` will delete all images whose tags contain the word "selenium" function docker-nuke() { args=("$@") docker ps -a | grep ${args[0]} | cut -d ' ' -f 1 | while read ID; do docker rm $ID; done; -
mycargus revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Purpose: Delete all images related to the provided tag name # Example: `docker-nuke selenium` will delete all containers and images related to "selenium" function docker-nuke() { args=("$@") -
mycargus revised this gist
Apr 11, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,9 @@ function docker-nuke() { docker images | grep ${args[0]} | tr -s " " | cut -d ' ' -f 3 | while read ID; do docker rmi $ID; done } # Purpose: Kill and remove all docker containers (except for dinghy_http_proxy) function docker-kill-all() { PROXY=$(docker ps | grep dinghy_http_proxy | awk '{print $1}') echo "Killing docker containers..." docker kill $(docker ps -q | grep -v $PROXY) &> /dev/null echo "Removing docker containers..." -
mycargus created this gist
Mar 20, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ # Purpose: Delete all containers and images related to the provided tag name # Example: `docker-nuke selenium` will delete all containers and images related to "selenium" function docker-nuke() { args=("$@") docker ps -a | grep ${args[0]} | cut -d ' ' -f 1 | while read ID; do docker rm $ID; done; docker images | grep ${args[0]} | tr -s " " | cut -d ' ' -f 3 | while read ID; do docker rmi $ID; done } # Purpose: Kill and remove all docker containers (except for dinghy-http-proxy) function docker-kill-all() { PROXY=$(docker ps | grep dinghy-http-proxy | awk '{print $1}') echo "Killing docker containers..." docker kill $(docker ps -q | grep -v $PROXY) &> /dev/null echo "Removing docker containers..." docker rm $(docker ps -a --filter "status=exited" -q) &> /dev/null } # Purpose: reset docker environment to clean slate function docker-reset() { docker-kill-all echo "Running docker-clean..." docker-clean } # Purpose: Remove all images function docker-rmi-all() { docker rmi -f $(docker images -q) } # Purpose: slap virtualbox # Example: Using virtualbox as the VM for dinghy's docker host sometimes causes image download # latency. Run this function in a separate shell window when that happens. function slap-virtualbox() { while true; do dinghy ssh echo "turbo mode activated"; done }