Skip to content

Commit

Permalink
fix(down): remove volumes automatically
Browse files Browse the repository at this point in the history
'docker compose down' will not by default remove volumes. This
caused orphaned volumes on long running VMs as well as on personal
machines. By adding the `--volumes` flag it now will remove them.
  • Loading branch information
Tieske committed Oct 24, 2023
1 parent 8e35566 commit 64a0607
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,14 @@ The result should be a new PR on the Pongo repo.
---
## unreleased
* Fix: `pongo down` would not remove volumes. This
caused orphaned volumes on long running VMs as well as on personal
machines.
---
## 2.7.0 released 7-Jul-2023
* Feat: Kong Enterprise 2.8.4.2, which means that Pongo 2.x will support the
Expand Down
6 changes: 3 additions & 3 deletions pongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ function pongo_down {
# if '--all' is passed then kill all environments, otherwise just current
if [[ ! "$1" == "--all" ]]; then
# just current env
compose down --remove-orphans
compose down --remove-orphans --volumes
exit
fi

Expand All @@ -801,7 +801,7 @@ function pongo_down {
PROJECT_ID=${network: -8}
PROJECT_NAME=${PROJECT_NAME_PREFIX}${PROJECT_ID}
SERVICE_NETWORK_NAME=${SERVICE_NETWORK_PREFIX}${PROJECT_ID}
compose down --remove-orphans
compose down --remove-orphans --volumes
done < <(docker network ls --filter 'name='$SERVICE_NETWORK_PREFIX --format '{{.Name}}')

PROJECT_ID=$p_id
Expand Down Expand Up @@ -1081,7 +1081,7 @@ function main {
;;

restart)
compose down --remove-orphans
compose down --remove-orphans --volumes
compose_up
;;

Expand Down

0 comments on commit 64a0607

Please sign in to comment.