← Back to Skills Marketplace
derick001

Docker Container Cleaner

by Derick · GitHub ↗ · v1.0.0
cross-platform ✓ Security Clean
437
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install docker-container-cleaner
Description
CLI tool to clean up stopped Docker containers, unused images, volumes, and networks to free up disk space.
README (SKILL.md)

Docker Container Cleaner

What This Does

A CLI tool that helps clean up Docker resources to free up disk space. It can:

  • List and remove stopped containers
  • Remove dangling images (images with no tag)
  • Remove unused images (not used by any container)
  • Remove unused volumes
  • Remove unused networks
  • Perform a "prune all" operation (Docker system prune)

The tool provides a safe, interactive mode by default, showing what will be removed and asking for confirmation before deleting anything.

When To Use

  • Your Docker disk usage is growing and you need to free up space
  • You have many stopped containers that are no longer needed
  • You have old, unused images taking up disk space
  • You want to clean up Docker resources in a controlled, safe way
  • You need to automate Docker cleanup in scripts or CI/CD pipelines

Usage

Interactive cleanup (recommended for first use):

python3 scripts/main.py clean

Remove stopped containers only:

python3 scripts/main.py clean --containers

Remove dangling images only:

python3 scripts/main.py clean --images --dangling

Remove unused images (all images not used by containers):

python3 scripts/main.py clean --images --unused

Remove unused volumes:

python3 scripts/main.py clean --volumes

Remove unused networks:

python3 scripts/main.py clean --networks

Force cleanup (no confirmation):

python3 scripts/main.py clean --all --force

Dry run (show what would be removed):

python3 scripts/main.py clean --all --dry-run

Examples

Example 1: Interactive cleanup

python3 scripts/main.py clean

Output:

Docker Cleanup Tool
===================

Found resources:
- Stopped containers: 3 (using 1.2GB)
- Dangling images: 5 (using 850MB)
- Unused images: 2 (using 450MB)
- Unused volumes: 1 (using 100MB)
- Unused networks: 0

Total disk space that can be freed: 2.6GB

What would you like to clean up?
1. Remove stopped containers
2. Remove dangling images
3. Remove unused images
4. Remove unused volumes
5. Remove unused networks
6. All of the above
7. Cancel

Enter choice [1-7]: 2

About to remove 5 dangling images (850MB):
- python:3.9-alpine (dangling)
- node:16-slim (dangling)
- ...

Are you sure? (y/N): y
Removing images...
✅ Cleanup complete! Freed 850MB of disk space.

Example 2: Script-friendly JSON output

python3 scripts/main.py status --format json

Output:

{
  "containers": {
    "running": 2,
    "stopped": 3,
    "stopped_size_mb": 1200
  },
  "images": {
    "total": 15,
    "dangling": 5,
    "dangling_size_mb": 850,
    "unused": 2,
    "unused_size_mb": 450
  },
  "volumes": {
    "total": 4,
    "unused": 1,
    "unused_size_mb": 100
  },
  "networks": {
    "total": 3,
    "unused": 0
  },
  "total_reclaimable_mb": 2600
}

Requirements

  • Python 3.x
  • Docker: Must be installed and the Docker daemon must be running
  • Docker CLI: Must be available in PATH (docker command)
  • Docker SDK for Python: Optional, but recommended for better performance

Install Docker SDK for Python (optional):

pip install docker

Limitations

  • This is a CLI tool, not an auto-integration plugin
  • Requires Docker daemon to be running and accessible
  • Some operations require elevated permissions (sudo)
  • Cannot clean up resources in use by running containers
  • Image size calculations are approximate
  • Network and volume cleanup may fail if resources are in use
  • Does not clean up Docker build cache (use docker builder prune)
  • Does not clean up Docker Compose resources automatically
  • Performance depends on number of Docker resources
  • Large cleanup operations may take significant time
Usage Guidance
This appears to be a local CLI tool that calls your Docker daemon to remove resources. Before using: (1) review the included scripts/main.py yourself (or run in a safe environment) to confirm behavior; (2) run with --dry-run first to see what would be removed; (3) avoid running in production unless you understand which containers/volumes/images will be deleted and have backups; (4) be aware Docker commands may require sudo or docker-group membership; (5) check the full script (not just the SKILL.md) if you have stricter security needs — the provided snippet was truncated in the review, so verify the complete file in your copy.
Capability Analysis
Type: OpenClaw Skill Name: docker-container-cleaner Version: 1.0.0 The OpenClaw skill 'docker-container-cleaner' is a Python CLI tool designed to clean up Docker resources. The `scripts/main.py` uses `subprocess.run` to execute `docker` commands, which is appropriate for its stated purpose. The arguments passed to `docker` are constructed from hardcoded strings and `argparse`-processed inputs, mitigating shell injection risks. There is no evidence of data exfiltration, unauthorized network activity, persistence mechanisms, or prompt injection attempts in the `SKILL.md` or `README.md` files. The code's behavior aligns with its documentation and intended functionality.
Capability Assessment
Purpose & Capability
Name/description (clean Docker resources) aligns with requirements (python3, docker) and the code which shells out to the Docker CLI and implements prune/status operations. No irrelevant binaries or credentials are requested.
Instruction Scope
SKILL.md only instructs running the included script and optional pip install for the Docker SDK. It does not instruct reading unrelated system files, sending data to external endpoints, or requesting secrets. Operations are limited to local Docker commands and reporting.
Install Mechanism
There is no install spec (instruction-only from platform perspective) and the repository includes a Python script. No remote downloads or archive extraction are specified by the skill metadata.
Credentials
The skill declares no required environment variables or credentials. It requires only the Docker daemon/CLI and Python, which are appropriate for its purpose. Some Docker operations may require elevated privileges (sudo or docker group), which is expected.
Persistence & Privilege
always is false, the skill is user-invocable and not force-installed. It does not request persistent system-wide privileges or modify other skills' configs in the provided content.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install docker-container-cleaner
  3. After installation, invoke the skill by name or use /docker-container-cleaner
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of docker-container-cleaner. - Introduces a CLI tool to safely clean up stopped containers, unused images, volumes, and networks to free disk space. - Supports interactive and script-friendly (JSON) modes. - Offers granular cleanup options (e.g., remove only containers, only dangling images, etc.). - Features --force (skip confirmation) and --dry-run (show what would be removed) flags. - Provides detailed status reports of Docker resources. - Requires Python 3 and Docker CLI; Docker SDK for Python is optional.
Metadata
Slug docker-container-cleaner
Version 1.0.0
License
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Docker Container Cleaner?

CLI tool to clean up stopped Docker containers, unused images, volumes, and networks to free up disk space. It is an AI Agent Skill for Claude Code / OpenClaw, with 437 downloads so far.

How do I install Docker Container Cleaner?

Run "/install docker-container-cleaner" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Docker Container Cleaner free?

Yes, Docker Container Cleaner is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Docker Container Cleaner support?

Docker Container Cleaner is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Docker Container Cleaner?

It is built and maintained by Derick (@derick001); the current version is v1.0.0.

💬 Comments