Skip to content

Commit 46ef7ed

Browse files
Fix docker volume prune command to properly remove volumes
The previous implementation used 'docker volume prune' which only removes unused/dangling volumes. Volumes created by Docker Compose remain referenced even after containers are stopped/removed, so prune wouldn't delete them. Changed to explicitly list volumes by label filter and remove them using xargs. This ensures all project volumes are deleted when running 'make prune'. Changes: - Replace 'docker volume prune' with 'docker volume ls | xargs docker volume rm' - Add error suppression for cross-platform compatibility (BSD/GNU xargs) - Add confirmation message showing which project's volumes were removed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8000305 commit 46ef7ed

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ images: ## Show all Images of ELK and all its extra components.
7979

8080
prune: ## Remove ELK Containers and Delete ELK-related Volume Data (the elastic_elasticsearch-data volume)
8181
@make stop && make rm
82-
@docker volume prune -f --filter label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}
82+
@docker volume ls --filter label=com.docker.compose.project=${COMPOSE_PROJECT_NAME} --format "{{.Name}}" | xargs docker volume rm 2>/dev/null || true
83+
@echo "Removed all volumes for project: ${COMPOSE_PROJECT_NAME}"
8384

8485
help: ## Show this help.
8586
@echo "Make Application Docker Images and Containers using Docker Compose (v2) files."

0 commit comments

Comments
 (0)