You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
600 B
17 lines
600 B
#!/bin/bash
|
|
|
|
# Set project-specific prefix to avoid deleting unrelated resources
|
|
PROJECT_PREFIX="project_mgnt"
|
|
|
|
echo "Starting Docker cleanup for project: $PROJECT_PREFIX..."
|
|
|
|
# Stop and remove containers associated with the project
|
|
echo "Stopping and removing containers..."
|
|
docker ps -a --filter "name=$PROJECT_PREFIX" --format "{{.ID}}" | xargs -r docker rm -f
|
|
|
|
# Remove networks associated with the project
|
|
echo "Removing networks..."
|
|
docker network ls --filter "name=$PROJECT_PREFIX" --format "{{.ID}}" | xargs -r docker network rm
|
|
|
|
echo "Docker cleanup for project: $PROJECT_PREFIX completed."
|