---
name: containerd-overlap-failed-cleanup
description: "Treating /var/lib/containerd's 12 GB as duplicate-with-Docker is wrong; cleanup recovered space briefly but came back after re-pull"
metadata:
node_type: memory
type: feedback
originSessionId: 71d40fa2-b151-4c81-9821-f0dfeb7a0f66
---

On 2026-05-15 I assumed `/var/lib/containerd/snapshots` (9.2 GB) and
`.../content/blobs` (2.5 GB) were duplicate-of-Docker storage that could
be reclaimed without losing functionality. I executed:

1. `docker compose down` (Dify + n8n)
2. `docker system prune -a -f` (without `--volumes`, n8n volumes preserved)
3. `docker compose up -d` (forced re-pull)
4. Recreated `ai-stack` external network manually (it had been pruned).

**Result:** Disk dropped 49 → 37 GB momentarily, but climbed straight
back to 49 GB once the re-pull finished. Net change: ~0 GB. All services
returned healthy and data was preserved (Dify uses bind mounts under
`/home/ubuntu/ai-stack/dify/docker/volumes/`, n8n uses named volumes
that survived the prune).

**Why the cleanup didn't stick:** With Docker daemon configured as
`dockerd ... --containerd=/run/containerd/containerd.sock`, Docker shares
its image storage with containerd. Both `/var/lib/docker/rootfs` and
`/var/lib/containerd/snapshots` are populated together on `docker pull`.
This is normal operation, not duplication. Reclaiming containerd alone
(`ctr image rm`, `ctr content prune`) would desync Docker's view and
risk crashing running containers, but does not actually free space that
Docker isn't already counting.

**How to apply:** Don't propose pruning `/var/lib/containerd` directly
on shadow. The real ways to free Docker disk on this host are:
- `docker image prune` for genuinely unused images (currently zero, all
images have running containers).
- Replacing heavy images with smaller ones (the langgenius/dify-* set
is ~9 GB unique, mostly unavoidable for Dify).
- Migrating Dify or n8n off shadow.

Side outcome of this exercise: an unused `ai-stack` external Docker
network now exists (was recreated to satisfy compose). Leaving it as
documented infra rather than removing.