Update for redis cleanup when deinit

This commit is contained in:
timqiu 2025-03-10 10:29:50 +08:00
parent 3d483a3b99
commit 86226130b6

View File

@ -859,7 +859,7 @@ devbox_init_command() {
exit 1 exit 1
fi fi
# Check if the custom repository is a git repository
# Test if the user can access the custom repository # Test if the user can access the custom repository
echo "==> Testing access to custom repository..." echo "==> Testing access to custom repository..."
if ! git ls-remote "$USE_CUSTOM_REPOSITORY" &>/dev/null; then if ! git ls-remote "$USE_CUSTOM_REPOSITORY" &>/dev/null; then
@ -1410,6 +1410,15 @@ devbox_deinit_command() {
rm -f "$WORKING_HOME/.mongodb-instance" rm -f "$WORKING_HOME/.mongodb-instance"
fi fi
if [[ -f "$WORKING_HOME/.redis-instance" ]]; then
local redis_container_id
redis_container_id=$(cat "$WORKING_HOME/.redis-instance")
echo "==> Stopping and removing Redis container: $redis_container_id"
docker stop "$redis_container_id" &>/dev/null || true
docker rm "$redis_container_id" &>/dev/null || true
rm -f "$WORKING_HOME/.redis-instance"
fi
# Stop and remove RabbitMQ container # Stop and remove RabbitMQ container
if [[ -f "$WORKING_HOME/.rabbitmq-instance" ]]; then if [[ -f "$WORKING_HOME/.rabbitmq-instance" ]]; then
local rabbitmq_container_id local rabbitmq_container_id