Skip to content

Commit 9f58a31

Browse files
authored
docker prune update (#2569)
1 parent 9c61970 commit 9f58a31

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/imaginary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ else
4646
if yesno_box_yes "Do you want to remove the Imaginary and all it's settings?"
4747
then
4848
# Remove docker container
49-
docker_prune_this 'nextcloud/aio-imaginary'
49+
docker_prune_this 'nextcloud/aio-imaginary' 'imaginary'
5050
# reset the preview formats
5151
nextcloud_occ config:system:delete "preview_imaginary_url"
5252
nextcloud_occ config:system:delete "enabledPreviewProviders"

lib.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,15 +1751,22 @@ fi
17511751
}
17521752

17531753
# Remove selected Docker image
1754-
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'nextcloud/aio-imaginary'
1754+
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'imaginary'
17551755
docker_prune_this() {
17561756
if does_this_docker_exist "$1"
17571757
then
17581758
if yesno_box_yes "Do you want to remove $1?"
17591759
then
1760-
docker stop "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
1761-
docker rm "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)" --volumes
1760+
CONTAINER="$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
1761+
if [ -z "$CONTAINER" ]
1762+
then
1763+
# Special solution if the container name is scrambled, then search for the actual name instead
1764+
CONTAINER="$(docker container ls -a | grep "$2" | awk '{print $1}' | tail -1)"
1765+
fi
1766+
docker stop "$CONTAINER"
1767+
docker rm "$CONTAINER"
17621768
docker image prune -a -f
1769+
docker system prune -a -f
17631770
else
17641771
msg_box "OK, this script will now exit, but there's still leftovers to cleanup. You can run it again at any time."
17651772
exit

0 commit comments

Comments
 (0)