Skip to content

Commit

Permalink
docker prune update (#2569)
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch85 authored Sep 27, 2023
1 parent 9c61970 commit 9f58a31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/imaginary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else
if yesno_box_yes "Do you want to remove the Imaginary and all it's settings?"
then
# Remove docker container
docker_prune_this 'nextcloud/aio-imaginary'
docker_prune_this 'nextcloud/aio-imaginary' 'imaginary'
# reset the preview formats
nextcloud_occ config:system:delete "preview_imaginary_url"
nextcloud_occ config:system:delete "enabledPreviewProviders"
Expand Down
13 changes: 10 additions & 3 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1751,15 +1751,22 @@ fi
}

# Remove selected Docker image
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'nextcloud/aio-imaginary'
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'imaginary'
docker_prune_this() {
if does_this_docker_exist "$1"
then
if yesno_box_yes "Do you want to remove $1?"
then
docker stop "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
docker rm "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)" --volumes
CONTAINER="$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
if [ -z "$CONTAINER" ]
then
# Special solution if the container name is scrambled, then search for the actual name instead
CONTAINER="$(docker container ls -a | grep "$2" | awk '{print $1}' | tail -1)"
fi
docker stop "$CONTAINER"
docker rm "$CONTAINER"
docker image prune -a -f
docker system prune -a -f
else
msg_box "OK, this script will now exit, but there's still leftovers to cleanup. You can run it again at any time."
exit
Expand Down

0 comments on commit 9f58a31

Please sign in to comment.