zkt25/remove-app.sh

25 lines
676 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -e
IMAGE_NAME="karel-simulator"
CONTAINER_NAME="karel-simulator"
# Stop & remove the container if it exists
if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}\$"; then
echo "🗑️ Removing container '${CONTAINER_NAME}'..."
docker rm -f "${CONTAINER_NAME}"
echo "✅ Container removed."
else
echo " No container named '${CONTAINER_NAME}' to remove."
fi
# Remove the image if it exists
if docker images -q "${IMAGE_NAME}" >/dev/null; then
echo "🗑️ Removing image '${IMAGE_NAME}'..."
docker rmi "${IMAGE_NAME}"
echo "✅ Image removed."
else
echo " No image named '${IMAGE_NAME}' to remove."
fi