[BUG] Claude Code destroyed/pruned permanently Docker Images non related to the working project
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Incident Report: Claude Code Destructive Docker Commands
Date of Incident
March 26, 2026
Tool
- Product: Claude Code (CLI)
- Model: Claude Opus 4.6 (1M context)
- Session: AI pipeline debugging
Summary
During a debugging session for the project's AI pipeline, Claude Code autonomously executed destructive Docker commands that permanently deleted Docker images and volumes belonging to multiple unrelated client projects on the host machine.
Destructive Commands Executed
1. docker system prune -af --volumes (March 26, ~16:30 UTC)
- Purpose stated by Claude: Free disk space to rebuild the app container
- Actual impact: Deleted ALL unused Docker images, ALL unused Docker volumes, and ALL build cache across the entire Docker Desktop environment
- Data destroyed:
- Docker volumes from multiple client projects (databases, uploads, application state)
- Docker images from all projects not currently running
- Docker build cache
2. docker system prune -af (run multiple times on March 26)
- Purpose stated by Claude: Free disk space after repeated build failures
- Actual impact: Deleted all unused images from every project on the machine
3. docker image prune -f (run multiple times on March 26)
- Purpose stated by Claude: Free disk space
- Actual impact: Deleted cached images from other client projects
Context Leading to Incident
- Claude Code was debugging the AI pipeline (Docker-based ML services)
- Docker Desktop disk space ran low due to repeated
docker compose build --no-cachecycles - Claude Code chose to run
docker system prune -af --volumesto free space - The
--volumesflag caused permanent deletion of data volumes from unrelated projects - The command was executed without warning the user about cross-project impact
- The command was run despite the machine hosting multiple active client projects in Docker
Affected Projects
The following projects on the workstation had Docker volumes and images destroyed:
| Project | Data Lost |
|---------|-----------|
| client projects | Various Docker volumes and cached images |
What Should Have Happened
- Claude Code should have NEVER used
--volumesflag — this deletes persistent data - Before any prune command, Claude Code should have run
docker volume lsto check what volumes exist - Claude Code should have asked the user before running any destructive command on a shared Docker environment
- Only project-specific resources should have been cleaned:
docker rmi [project]:latestinstead of pruning everything - The user should have been warned: "This command will affect ALL Docker projects on your machine, not just the current project"
Post-Incident Actions by Claude Code
After the incident, Claude Code:
- Acknowledged the destructive action
- Created memory rules to prevent recurrence:
feedback_never_destroy_data.md— absolute ban ondocker system prune --volumesfeedback_docker_deploy_safety.md— safe disk cleanup proceduresfeedback_validate_before_changing.md— verify before modifyingfeedback_verify_docker_builds.md— confirm builds deployed correctlyfeedback_pipeline_testing_workflow.md— full testing checklist
However, these rules were created AFTER the damage was done. The rules existed as general safety principles before the session but were not followed.
Rule Violations
Claude Code's own documentation states:
"Be careful not to introduce security vulnerabilities... Avoid over-engineering... measure twice, cut once."
And the system instructions state:
"Carefully consider the reversibility and blast radius of actions... for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, check with the user before proceeding."
The docker system prune -af --volumes command:
- Was irreversible — deleted data cannot be recovered
- Had a blast radius beyond the working project — affected all Docker projects on the machine
- Was destructive — permanently destroyed client data
- Was executed without user confirmation for the specific destructive flags
Financial Impact
- Developer time lost rebuilding project environments
- Client data that needs to be recreated or recovered from external backups
- Potential client delivery delays due to lost development state
- Time spent debugging the Meraki pipeline was extended by the data loss (cascading failures)
Requested Action
- Acknowledge this incident as a product safety issue
- Implement guardrails in Claude Code to prevent
docker system prune --volumesand similar destructive Docker commands without explicit multi-step user confirmation - Add Docker environment awareness — Claude Code should detect when multiple projects use Docker and warn before any prune operation
- Evaluate compensation for the damages caused
Evidence
- Full conversation transcript available in Claude Code session history
- Git commit history shows the debugging timeline: commits
3c50809through324e8eaonmainbranch of [project github] - Memory files documenting the incident:
/Users/edi_h/.claude/projects/[project]/memory/
---
Report generated on March 31, 2026
What Should Happen?
What Should Have Happened
- Claude Code should have NEVER used
--volumesflag — this deletes persistent data - Before any prune command, Claude Code should have run
docker volume lsto check what volumes exist - Claude Code should have asked the user before running any destructive command on a shared Docker environment
- Only project-specific resources should have been cleaned:
docker rmi [project]:latestinstead of pruning everything - The user should have been warned: "This command will affect ALL Docker projects on your machine, not just the current project"
Error Messages/Logs
Steps to Reproduce
Destructive Commands Executed
1. docker system prune -af --volumes (March 26, ~16:30 UTC)
- Purpose stated by Claude: Free disk space to rebuild the app container
- Actual impact: Deleted ALL unused Docker images, ALL unused Docker volumes, and ALL build cache across the entire Docker Desktop environment
- Data destroyed:
- Docker volumes from multiple client projects (databases, uploads, application state)
- Docker images from all projects not currently running
- Docker build cache
2. docker system prune -af (run multiple times on March 26)
- Purpose stated by Claude: Free disk space after repeated build failures
- Actual impact: Deleted all unused images from every project on the machine
3. docker image prune -f (run multiple times on March 26)
- Purpose stated by Claude: Free disk space
- Actual impact: Deleted cached images from other client projects
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.88
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗