/kamal-skills:prunefrom kamal-skills
Prune old Kamal containers and images and control how many Kamal keeps around. Kamal retains the last 5 deployed containers and the images they use; everything older is removed. Use when the user says "prune old images," "clean up old containers," "my servers are running out of disk," "free up space on my servers," "remove unused Docker images," "kamal prune," "how many old releases does Kamal keep," or "change how many containers I keep." Covers `kamal prune all`, `kamal prune containers`, `kamal prune images`, and tuning retention with the `retain_containers` config key (default 5). For running a full deploy, which prunes automatically at the end, see deploy. For inspecting and managing already-running app containers, see app.
Ships in kamal-skills. 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.
You are an expert in deploying applications with Kamal. Your goal is to keep servers from filling up with old container and image layers — by understanding what Kamal prunes automatically, running a manual prune when you need to reclaim space, and tuning how many old releases Kamal keeps.
Read the project's Kamal config before asking the user questions — it tells you how many releases this app retains.
config/deploy.yml — the default config file. Look for a retain_containers: setting; if it's absent, Kamal uses the default.config/deploy.<destination>.yml — destination-specific config (for example config/deploy.staging.yml).Kamal keeps the last 5 deployed containers and the images they are using. Pruning deletes all older containers and images.
This retention is what makes pruning safe: the most recent releases stay on your servers, so you can still inspect or roll back to them, while stale layers that nothing references get cleaned away to reclaim disk.
You usually don't run pruning by hand. It is wired into the deploy flow:
kamal deploy prunes unused images and stopped containers at the end of every deploy, so servers don't fill up over time.kamal redeploy skips pruning (along with bootstrapping, starting kamal-proxy, and registry login) to be faster.Run a manual prune when you've been redeploying repeatedly, are running low on disk, or want to clean up on demand between deploys.
kamal prune allkamal prune imageskamal prune containers# Most common: clean up both unused images and stopped containers
kamal prune all
Kamal keeps the last 5 deployed containers and the images they use, so this only removes layers older than your retention window.
# Remove only unused images
kamal prune images
# Remove only stopped containers, keeping the last n (default 5)
kamal prune containers
kamal prune is a command group. Running it on its own lists the available subcommands rather than pruning anything — call a subcommand to act:
| Command | What it prunes |
|---|---|
kamal prune all | Unused images and stopped containers |
kamal prune containers | Stopped containers, except the last n (default 5) |
kamal prune images | Unused images |
kamal prune help [COMMAND] | Describe subcommands, or one specific subcommand |
For the full subcommand reference and how pruning ties into kamal deploy, see references/prune-commands.md.
retain_containersThe number of old containers and images Kamal keeps is configurable. Set retain_containers in config/deploy.yml:
# Keep only the last 3 old containers and images instead of the default 5
retain_containers: 3
| Config key | Default | What it controls |
|---|---|---|
retain_containers | 5 | How many old containers and images Kamal retains |
Lower it to reclaim disk more aggressively; raise it if you want more previous releases available on the servers. This is the n that kamal prune containers honors ("except the last n").
| Goal | Command / Config |
|---|---|
| Clean up unused images and stopped containers | kamal prune all |
| Remove only unused images | kamal prune images |
| Remove only stopped containers (keep last n) | kamal prune containers |
| List the prune subcommands | kamal prune |
| Keep fewer / more old releases | retain_containers: N in config/deploy.yml |
| Prune automatically | Run kamal deploy (prunes at the end) |
kamal deploy (which prunes unused images and stopped containers at the end) and kamal redeploy (which skips pruning).kamal app subcommands before or after you prune.What SKILL.md sets; muted values are Claude Code's defaults
25 skills in this plugin
/accessoriesRun and manage accessory services — databases, Redis, search, and other long-lived dependencies your app needs — through Kamal's `accessories:` configuration and the `kamal accessory` command. Use this when the user says things like "add a MySQL/Postgres/Redis accessory," "run a database with Kamal," "kamal accessory boot," "set up a sidecar/companion service," "my app needs a cache or search container," "persist accessory data with volumes," or "reboot/restart/remove an accessory." Covers defining the accessory (image, host/hosts/role/roles/tag/tags, port, env, files, directories, volumes, network, options, registry, proxy) and operating it with boot, reboot, restart, start, stop, details, logs, exec, and remove. For passing configuration and credentials into accessories, see env and secrets. For scheduled jobs, see cron./aliasesDefine custom command aliases under the top-level `aliases` key in `config/deploy.yml` so a long, repeated `kamal` invocation becomes a single `kamal <name>`. Use it when the user says "add a Kamal alias," "shortcut kamal app exec," "make `kamal console` open a Rails console," "create a one-liner to deploy staging," "I keep retyping the same kamal command," or asks about the `aliases` config key, alias naming rules, or a `deploy -d staging` shortcut. Covers how an alias expands into a `kamal` subcommand, the lowercase letters/numbers/dashes/underscores naming rule, and the documented examples `console: app exec -i --reuse "bin/rails console"`, `uname: app exec -p -q -r web "uname -a"`, and `staging_deploy: deploy -d staging`. For the rest of `config/deploy.yml` and DRYing it up with YAML anchors, see config. For the underlying app exec / console / logs commands the aliases wrap, see app.npx claudepluginhub donnfelker/kamal-skills --plugin kamal-skillsOther plugins' skills for the same job