CLI tool for managing Docker container cleanups
Project description
Docker Tools Plus
A command-line tool for managing Docker container cleanups using predefined regular expression patterns.
Features
- ๐ณ Create named cleanup configurations with regular expressions
- ๐๏ธ Clean containers, volumes, and images matching patterns
- ๐พ SQLite database for persistent configuration storage
- ๐ Interactive prompts for multiple matches
- ๐ก๏ธ Safety confirmations before destructive operations
Installation
- Install using uv:
uv pip install git+https://github.com/yourusername/docker-tools-plus.git
- Verify installation:
docker-tools-plus --help
Usage
Create and Execute Cleanup
docker-tools-plus clean <name> [--force]
- Use
--forceto skip all confirmation prompts - Automatically cleans all resource types without asking
Example flow without --force:
$ docker-tools-plus clean reconciliation
No cleanup found matching 'reconciliation'
Please enter a regular expression: reconciliation[a-z_]*_postgres
Created new cleanup config:
ID: 1 | Name: reconciliation | Pattern: reconciliation[a-z_]*_postgres
Clean containers? [Y/n]: y
Clean volumes? [Y/n]: y
Clean images? [Y/n]: y
Example with --force:
$ docker-tools-plus clean reconciliation --force
Created new cleanup config:
ID: 1 | Name: reconciliation | Pattern: reconciliation[a-z_]*_postgres
Cleaning containers... done
Cleaning volumes... done
Cleaning images... done
List All Cleanups
docker-tools-plus list
Output:
1: reconciliation - reconciliation[a-z_]*_postgres
2: temp-containers - temp_.+
Delete a Cleanup
docker-tools-plus delete <name>
Example:
$ docker-tools-plus delete temp
Multiple matches found:
1: temp-containers
2: temp-images
Enter the ID to delete: 1
Delete cleanup 'temp-containers' (ID: 1)? [y/N]: y
Show Info
docker-tools-plus about
Displays application information in a formatted panel with:
- Application name and version (centered)
- Database location with file existence indicator (โ if exists, โ if missing)
- Description
Example panel:
โ About โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ docker-tools v0.4.2 โ
โ โ
โ Database location: /path/to/cleanups.db โ โ
โ โ
โ CLI tool for managing Docker container cleanups โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Reset Database
docker-tools-plus reset
Creates a timestamped backup of the current database and creates a new blank one. Requires confirmation unless --force is used.
Example:
$ docker-tools-plus reset
This will rename your current database and create a new blank one. Continue? [y/N]: y
Renamed existing database to cleanups_20240614_123456.db
Created new blank database successfully.
Configuration
Create configuration.toml to customize:
[database]
path = "custom_cleanups.db"
Development
# Install dev dependencies
uv pip install -e '.[dev]'
# Run tests
make test
# Generate coverage report
make cov
# Lint code
make lint
Database Management
The default application path is ~/.config/docker-tools-plus/.
This path will probably not work on Windows, so you can specify a custom path in configuration.toml:
The SQLite database is automatically created at:
- Default:
docker_tools_plus.db - Custom: Path specified in
configuration.toml
Safety Features
- Confirmation Prompts for destructive operations
- Always asks before cleaning each resource type (containers/volumes/images)
- Can be skipped with
--forceoption
- Separate Resource Types (containers/volumes/images)
- Force Mode (use with caution):
- Skips all confirmation prompts
- Automatically cleans all resource types
- Requires explicit
--forceflag:
docker-tools-plus clean <name> --force
โ ๏ธ Warning: Regular expressions are powerful - test patterns with docker ps -a/docker volume ls/docker image ls before creating cleanup configurations.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docker_tools_plus-0.5.1.tar.gz.
File metadata
- Download URL: docker_tools_plus-0.5.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dba7e779ff60c34a0e9be1d7be39e1b0579ad0580fbb5136c57f5dae3223e9c
|
|
| MD5 |
df82bfc3889f58050a5fb70b1a9eca57
|
|
| BLAKE2b-256 |
282b7ee435f8a81e6f778b8930779d3eed4dc5aea0e99adfd79140365fac72ec
|
File details
Details for the file docker_tools_plus-0.5.1-py3-none-any.whl.
File metadata
- Download URL: docker_tools_plus-0.5.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b97d2ae5970cf1eacdce56baf633abfd523f9453db2e02516df3628479758fc
|
|
| MD5 |
9dba2ecb8b59f1269599b7c74369cd3e
|
|
| BLAKE2b-256 |
77535bcd238845f40084ea34dcf9ccef2b74b4b97de0a133b52f18f2cf02bedc
|