-
Notifications
You must be signed in to change notification settings - Fork 222
Uninstall
BenM edited this page Jul 25, 2023
·
9 revisions
This guide explains how to completely remove a Hashtolopis system which had been installed using Docker, including removing files, database and network.
If you simply want to update version and wish to keep Database, Files and Network, just customize the script below.
- Go to your project or preferred location and create a file
touch uninstaller.sh
, thennano uninstaller.sh
and paste the script below - Run the script
bash uninstaller.sh
- Done
#!/usr/bin/env bash
CONTAINER_NAME="hashtopolis"
DB_NAME="db"
IMAGE_BACKEND_NAME="hashtopolis/backend"
IMAGE_FRONTEND_NAME="hashtopolis/frontend"
VOLUME_NAME="server_hashtopolis"
VOLUME_DB_NAME="server_db"
NETWORK_NAME="server_default"
# 1 - Stop and remove running app container(s)
docker ps -q --no-trunc --filter "name=$CONTAINER_NAME" | xargs -r docker stop
docker ps -a -q --filter "name=$CONTAINER_NAME" | xargs -r docker rm
# 2 - Stop and remove running app container(s)
docker ps -q --no-trunc --filter "name=$DB_NAME" | xargs -r docker stop
docker ps -a -q --filter "name=$DB_NAME" | xargs -r docker rm
# 3 - Remove Volume, comment this line if you don't want to the volume
docker volume ls --filter "name=$VOLUME_NAME" | xargs -r docker volume rm --force
docker volume ls --filter "name=$VOLUME_DB_NAME" | xargs -r docker volume rm --force
# 4 - Remove image
docker image rmi "$IMAGE_BACKEND_NAME"
docker image rmi "$IMAGE_FRONTEND_NAME"
# 5 - Remove Network
docker network ls -q --no-trunc --filter "name=$NETWORK_NAME" | xargs -r docker network rm --force
# 6 - Prune container and volume
docker container prune -f && docker volume prune -f