Clean to Execute
clean-to-execute removes Docker Compose resources for a local clone of a
GitHub repository.
The repository is found recursively by inspecting Git remotes under the user's home directory. Directory names alone are not trusted. Docker Compose files must be at the repository root.
Requirements
- Python 3.10 or newer
- Git
- Docker with the Compose plugin
- Access to a running Docker daemon
Installation
From this directory:
python3 -m pip install .
Usage
Execute cleanup:
clean-to-execute --organization kaizten --repository example
Preview cleanup without changing Docker resources:
clean-to-execute --organization kaizten --repository example --dry-run
Search somewhere other than ~:
clean-to-execute \
--organization kaizten \
--repository example \
--root /workspaces
Cleanup is destructive by default. Use --dry-run when only a preview is
required.
Cleanup scope
The command recognizes compose.yaml, compose.yml, docker-compose.yaml,
and docker-compose.yml at the repository root. Docker Compose renders the
effective configuration, including its normal override and environment
interpolation behavior. All Compose profiles are activated for inspection and
shutdown, so services and ports behind profiles are included without requiring
the caller to name each profile.
By default, the command:
- Stops and removes the entire Compose project, including orphan containers, so all of its published ports are released.
- Deletes the project's non-external named and anonymous volumes.
- Deletes all other dangling Docker volumes, while preserving external volumes declared by this Compose project.
- Force-removes local images referenced by the Compose configuration whose namespace matches the GitHub organization.
The namespace comparison works across registries. For example, all of these
belong to the GitHub organization kaizten:
kaizten/apidocker.io/kaizten/apighcr.io/kaizten/apiregistry.example.com/kaizten/api
Containers outside the selected Compose project are never stopped or removed. An external container may still prevent Docker from deleting an image; that is reported as a cleanup failure.
If multiple local clones match the same GitHub remote, the command lists them and exits instead of choosing one implicitly.
Development
python3 -m unittest discover -s tests -v
./build-package.sh
Metadata
Release files for clean-to-execute 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clean_to_execute-0.0.1.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clean_to_execute-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / clean_to_execute-0.0.1.tar.gz
| Download URL | clean_to_execute-0.0.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c35b5267d4dbba7405824fc04435664483da74cb19b4893e5b17a656a0028def
|
|
BLAKE2b-256 checksum How to use checksums |
7ea16cc53ee1aa29fdea0b111da5fa19f15b926bdfc249cb4f4ae9d1f4945543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / clean_to_execute-0.0.1-py3-none-any.whl
| Download URL | clean_to_execute-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
477d8869dc9535c0dae15e824f8dfb2b5ec08ebabb956dc082c367348e589d08
|
|
BLAKE2b-256 checksum How to use checksums |
e403a4309c7d4b5cf23ba66883f4f333e294208e5a039fe3c80df82d68f15f1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|