cleanup
GitHub清理 Learn Docker & K8s 游戏产生的容器、网络、卷和镜像等资源。支持按章节或全部清理,执行前需确认并警告进度丢失风险,清理后更新玩家进度文件以重置挑战状态。
Trigger Scenarios
Install
npx skills add ericboy0224/learn-docker-and-k8s --skill cleanup -g -y
SKILL.md
Frontmatter
{
"name": "cleanup",
"description": "Clean up Docker resources created by the Learn Docker & K8s game. Removes all learn-* containers, networks, volumes, and images. Use when the user wants to clean up, reset, or free disk space.",
"argument-hint": "[chapter|all]",
"disable-model-invocation": true
}
Cleanup Game Resources
This is a destructive operation. Always confirm with the player first.
Step 1: Show What Exists
echo "=== Containers ==="
docker ps -a --filter "label=app=learn-docker-k8s" --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"
echo ""
echo "=== Networks ==="
docker network ls --filter "label=app=learn-docker-k8s" --format "table {{.Name}}\t{{.Driver}}"
echo ""
echo "=== Volumes ==="
docker volume ls --filter "label=app=learn-docker-k8s" --format "table {{.Name}}\t{{.Driver}}"
echo ""
echo "=== Images ==="
docker images --filter "reference=learn-*" --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"
Step 2: Confirm
Show the player what will be removed and ask for confirmation.
If $ARGUMENTS is a specific chapter (e.g., "ch01", "ch03"):
- Only remove resources with the matching chapter label
- Tell them: "I'll only remove Chapter X resources. Everything else stays."
If $ARGUMENTS is "all" or empty:
- Run
bash engine/cleanup.sh - Also check for kind clusters:
kind get clusters 2>/dev/null | grep learn
Step 3: Clean
After confirmation, execute the cleanup and report what was removed.
If they're in the middle of a chapter, warn them: "You have in-progress work in Chapter X. Cleaning up means you'll need to redo the challenges. Continue?"
Step 4: Update Progress (if needed)
If cleaning a specific chapter, update .player/progress.yaml:
- Reset that chapter's challenges to empty
- Set status back to "in-progress" (keep lesson progress)
Version History
- da325b6 Current 2026-07-25 07:24


