Dkrutil
Dkrutil is a command-line tool that provides utility functions for managing Docker containers, volumes, images, and
secrets.
It simplifies common tasks like listing running containers, backing up and restoring volumes, retrieving Docker image
tags from Docker Hub, and securely managing secrets via Docker volumes.
Installation
You can install dkrutil directly from PyPI:
pip install dkrutil
For isolated environments and ease of management, you can use pipx:
pipx install dkrutil
Or install it using uv for development:
uv pip install dkrutil
Usage
Dkrutil provides the dkrutil command with various subcommands.
Containers
List running containers
dkrutil container ps
Options:
-a, --all→ Show all containers, including stopped ones.
Volumes
Backup Docker volumes
dkrutil volume backup -d /path/to/backup
Options:
-d, --backup-directory→ Directory where the volumes will be backed up.-i, --include→ Regex pattern to include specific volumes (can be repeated).-I, --ignore→ Regex pattern to ignore specific volumes (can be repeated).-v, --verbose→ Show skipped volumes in real time.
Restore Docker volumes
dkrutil volume restore -d /path/to/backup
Options:
-d, --backup-directory→ Directory containing the backup files.
Images
Retrieve all tags of an image
dkrutil image tags alpine
Options:
-d, --digest→ Filter tags by a specific SHA256 digest.-t, --tag→ Retrieve the digest of a specific tag.
Secrets
Create a secret stored in a Docker volume
dkrutil secret create <name> [FILE|-] [-p]
This command stores a secret securely inside a Docker named volume.
- If
FILEis omitted or set to-, the content is read from standard input. - A file named
<name>will be created inside the volume<name>with the secret content. - If the volume already exists, the command will fail (no overwrite).
- Use -p to force an interactive masked prompt.
Examples:
# From a file
dkrutil secret create db_password ./my-password.txt
# From stdin
echo "supersecret" | dkrutil secret create db_password
# Prompt
dkrutil secret create db_password -p
Configuration
Dkrutil uses the docker Python library to interact with the Docker API. Ensure Docker is installed and running
before using this tool.
Development
Clone the repository:
git clone https://github.com/emerick-biron/dkrutil.git
cd dkrutil
Install dependencies with uv:
uv pip install -e .
Run the tool locally:
dkrutil --help
Build the package:
uv build
Metadata
Release files for dkrutil 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dkrutil-1.0.6.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dkrutil-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / dkrutil-1.0.6.tar.gz
| Download URL | dkrutil-1.0.6.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ed3482e089506ea7964c37394262eb63f2e9d388c1bda916f7e566eb53fe2a1
|
|
BLAKE2b-256 checksum How to use checksums |
eba1cc25f4579ad92cefe3a2e78a4c7c717cb9ea42db25f1bf3373fc113a47b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dkrutil-1.0.6-py3-none-any.whl
| Download URL | dkrutil-1.0.6-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da9bbcf2c1b409b8c0bc10d560026423d3ba5d3b8e8b81d2ac0fa10d3aab1d7a
|
|
BLAKE2b-256 checksum How to use checksums |
906e97fed4553ad34563c4b36b4748047a84a735fcf811a72396953586de5d3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|