/linux:linux-image-hygienefrom linux
Measures and reclaims Docker/Podman storage on Debian/Ubuntu or RHEL-family hosts. Covers images, cache, networks, and volume pruning with safe cleanup and systemd timer scheduling.
Ships in linux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Two-family skill. The prune commands are nearly identical between Docker and
Podman; the differences are storage location (Docker keeps everything under
/var/lib/docker; rootless Podman under ~/.local/share/containers) and that
on RHEL you usually drive Podman. The body below shows Docker on Debian/Ubuntu;
substitute per this matrix.
| Concept | Debian/Ubuntu | RHEL family |
|---|---|---|
| Disk usage report | docker system df | podman system df |
| Prune (safe: dangling + stopped) | docker system prune | podman system prune |
| Prune everything unused | docker system prune -a --volumes | podman system prune -a --volumes |
| Unused images only | docker image prune -a | podman image prune -a |
| Dangling images only | docker image prune | podman image prune |
| Unused volumes | docker volume prune | podman volume prune |
| Unused networks | docker network prune | podman network prune |
| Storage root | /var/lib/docker | /var/lib/containers (root) / ~/.local/share/containers (rootless) |
| Schedule | systemd timer (system) | systemd timer; rootless uses --user + linger |
RHEL-family notes: rootless Podman storage is per-user under
~/.local/share/containers/storage — a docker system prune as root will not
touch it; run podman system prune as the owning user. A scheduled prune for a
rootless user needs a --user timer plus loginctl enable-linger. See
../../docs/multi-distro/plan.md.
/var/lib/docker, container storage).linux-container-engine.linux-container-deployment.linux-disk-storage.| Artefact | Required? | Source | If absent |
|---|---|---|---|
| Engine, execution user, storage root, and pressure target | yes | Host inventory and filesystem metrics | Measure only; do not prune. |
| Object ownership and retention policy | yes for -a/volumes | Workload owners | Limit to dangling objects or stop. |
| Approved destructive scope and rollback/re-pull plan | mutation | Change approval | Produce a candidate list only. |
-a --volumes).Storage measurement and candidate listing are read-only. Every prune is destructive and requires explicit scope; --volumes requires separate confirmation from data owners. Scheduled cleanup requires authority to create and enable units.
Without engine access, return measurement commands only. If object ownership cannot be established, do not classify it as unused. If reclaim cannot be measured, report the result as unverified.
| Choice | Action | Failure or risk avoided |
|---|---|---|
| Dangling versus all unused | Start with dangling; use -a only after reconciling stopped workloads and rollback images. | Deleting needed rollback artefacts. |
| Volumes | Exclude by default; prune only named approved volumes after backup/ownership checks. | Irrecoverable state loss. |
| Rootful versus rootless | Inspect each relevant user's storage separately. | Cleaning the wrong store. |
| Scheduled prune | Schedule only a conservative, logged scope with disk thresholds. | Unattended destructive cleanup. |
Measure first with docker system df / podman system df.
Identify what is genuinely unused (dangling images, stopped containers, orphan volumes).
Prune from least to most aggressive; confirm before -a --volumes.
Optionally install a scheduled prune (systemd timer) and verify it ran.
Stop before any object whose owner or retention need is unresolved; recover deleted images by re-pulling recorded digests, while volumes require the separately proven backup restore path.
system df before pruning so the reclaim is measured, not guessed.-a --volumes for hosts you fully understand.Pruning volumes by default. Fix: exclude them unless owners separately approve named targets.
Treating unused as ownerless. Fix: reconcile stopped workloads and rollback images.
Cleaning the wrong user store. Fix: record engine, rootful/rootless mode, and execution user.
Reporting estimated savings as reclaimed. Fix: compare pre/post engine and filesystem usage.
Scheduling aggressive cleanup silently. Fix: use conservative scope with logs, thresholds, and alerts.
Running docker system prune -a --volumes on a host with paused-to-investigate images, or with data-bearing volumes.
Scheduling an aggressive -a --volumes prune unattended on a DB/stateful host.
Cleaning root Docker storage and assuming rootless Podman storage was also freed.
Treating "unused" as ownerless. Correction: reconcile stopped stacks, rollback images, and named volumes with owners.
Reporting estimated savings as reclaimed. Correction: capture before/after filesystem and engine measurements.
Scheduling cleanup without logs or alerting. Correction: retain unit output and alert on failure or low space.
| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Prune plan | Host owner | Lists engine/user, exact candidate classes, exclusions, approvals, and commands. |
| Reclaim report | Capacity owner | Shows before/after engine and filesystem usage plus objects removed. |
| Timer evidence | On-call operator | Conservative scope, schedule, logs, next run, and failure status are verifiable. |
| Artefact | Acceptance |
|---|---|
| Reclaim evidence | Contains engine/user context, pre/post usage, candidate scope, approval, prune output, and timer status. |
Capture engine/user context, pre/post system df, filesystem free space, candidate list, approval for aggressive scopes, prune output, and timer status. Never call an unmeasured action successful.
For rootless Podman pressure, inspect the affected user's store, preserve images referenced by stopped rollback containers, prune dangling build artefacts only, and compare both Podman and filesystem bytes before and after.
system df).references/prune-and-scheduling.md — prune scopes, filters, storage layout, and the systemd prune timer.This skill is self-contained. Every command below is a standard engine tool
— docker on Debian/Ubuntu, podman on the RHEL family (see the Distro
support matrix). The sk-* script is an optional convenience wrapper — never
required.
This skill owns disk reclamation. It does not own installing the engine
(linux-container-engine) or running containers (linux-container-deployment).
docker system df # TYPE / TOTAL / ACTIVE / RECLAIMABLE
docker system df -v # per-image, per-volume detail
# Podman:
podman system df
RECLAIMABLE is the headline number — what a prune would free.
# 1. Dangling images only (untagged <none> layers) — always safe
docker image prune
# 2. Stopped containers + dangling images + unused networks + build cache
docker system prune
# 3. All images not used by a running container (not just dangling)
docker image prune -a
docker image prune -a --filter 'until=720h' # only images older than 30 days
# 4. Everything unused, INCLUDING named volumes — destructive
docker system prune -a --volumes
# Targeted:
docker container prune # stopped containers
docker volume prune # unused volumes (data loss risk!)
docker network prune # unused user-defined networks
docker builder prune # build cache
docker system prune -adeletes images not used by a running container — including ones you stopped to investigate. Always rundocker system prune(no-a) first, and never auto-prune--volumeson a stateful host.
Podman is the same surface:
podman image prune -a # all unused images
podman system prune # stopped containers + dangling + cache
podman system prune -a --volumes
podman volume prune
[GROUNDING-GAP: image/volume/cache prune semantics and filters (until=, label=, dangling=) — grounded on Podman/Docker upstream docs; deepen with Container Security (Liz Rice)]
The cleanest way to keep a host tidy is a *.timer + *.service pair that runs
a safe prune nightly. System scope (Docker / root Podman):
# /etc/systemd/system/container-prune.service
[Unit]
Description=Scheduled container image/cache prune
[Service]
Type=oneshot
ExecStart=/usr/local/bin/sk-container-prune --yes --schedule-safe
# /etc/systemd/system/container-prune.timer
[Unit]
Description=Run container prune daily
[Timer]
OnCalendar=*-*-* 03:30:00
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now container-prune.timer
systemctl list-timers container-prune.timer
The sk-container-prune script below installs exactly this timer for you.
For rootless Podman use systemctl --user units plus
loginctl enable-linger <user>. Full detail (filters, storage layout, cron
alternative) is in
references/prune-and-scheduling.md.
[GROUNDING-GAP: systemd prune timer scheduling — grounded on Podman/Docker + systemd.timer upstream docs; deepen with Container Security (Liz Rice)]
Running sudo install-skills-bin linux-image-hygiene installs:
| Task | Fast-path script |
|---|---|
| Report reclaimable space, prune at chosen scope, optionally install the daily timer | sudo sk-container-prune |
This is an optional wrapper. The docker/podman prune commands above are the
source of truth.
This skill installs the following scripts to /usr/local/bin/. To install:
sudo install-skills-bin linux-image-hygiene
| Script | Source | Core? | Purpose |
|---|---|---|---|
| sk-container-prune | scripts/sk-container-prune.sh | yes | Report reclaimable space (system df), then prune Docker and/or Podman at a chosen scope (safe / images / aggressive); asks before each destructive step; can install a daily systemd prune timer. Both families. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
docker, podman, container-cleanup, disk-space, systemd-timer
npx claudepluginhub peterbamuhigire/linux-skills --plugin linux45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors./linux-auditd-rulesUse when inspecting, designing, testing, persisting, or querying auditd rules for forensic attribution on Debian/Ubuntu or RHEL-family hosts. Covers watches, syscalls, loss, and immutable mode; use linux-file-integrity for drift and linux-benchmark-scanning for scoring./linux-bash-scriptingUse when writing or reviewing portable sk-* Bash scripts for this engine, including common.sh primitives, flags, preview mode, and safety gates; use linux-repo-sync for Git-update behaviour and not for one-off commands./linux-benchmark-scanningUse when running read-only OpenSCAP or Lynis scans, selecting distro-matched profiles, interpreting failures, or drafting remediation on Debian/Ubuntu or RHEL-family hosts. Use linux-auditd-rules for attribution and linux-file-integrity for AIDE drift.Other plugins' skills for the same job