# 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:
```bash
pip install dkrutil
```
For isolated environments and ease of management, you can use `pipx`:
```bash
pipx install dkrutil
```
Or install it using [uv](https://github.com/astral-sh/uv) for development:
```bash
uv pip install dkrutil
```
> [!WARNING]
> Some `dkrutil` commands (e.g., **volume backups** and **secrets management**) require **root privileges**.  
> If you installed `dkrutil` in a user-local directory (e.g., `~/.local/bin` via `pip` or `pipx`), make sure the `dkrutil` binary is > accessible to `root`.  
> For example:
> ```
> sudo cp ~/.local/bin/dkrutil /usr/local/bin/
> ```
> This ensures `dkrutil` can be used in scripts or commands requiring `sudo`.
## Usage
Dkrutil provides the `dkrutil` command with various subcommands.
### Containers
#### List running containers
```bash
dkrutil container ps
```
Options:
- `-a, --all` → Show all containers, including stopped ones.
### Volumes
#### Backup Docker volumes
```bash
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
```bash
dkrutil volume restore -d /path/to/backup
```
Options:
- `-d, --backup-directory` → Directory containing the backup files.
### Images
#### Retrieve all tags of an image
```bash
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
```bash
dkrutil secret create <name> [FILE|-]
```
This command stores a secret securely inside a Docker named volume.
- If `FILE` is 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).
Examples:
```bash
# From a file
dkrutil secret create db_password ./my-password.txt
# From stdin
echo "supersecret" | dkrutil secret create db_password
```
## 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:
```bash
git clone https://github.com/emerick-biron/dkrutil.git
cd dkrutil
```
Install dependencies with uv:
```bash
uv pip install -e .
```
Run the tool locally:
```bash
dkrutil --help
```
Build the package:
```bash
uv build
```
            
         
        Raw data
        
            {
    "_id": null,
    "home_page": null,
    "name": "dkrutil",
    "maintainer": "emerick-biron",
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "backup, cli, container, devops, docker, secrets, volume",
    "author": "emerick-biron",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0e/e4/3940b7ccae028822044f713fddce007ca878fead3ff461af25bfe0190f9b/dkrutil-1.0.5.tar.gz",
    "platform": null,
    "description": "# Dkrutil\n\nDkrutil is a command-line tool that provides utility functions for managing Docker containers, volumes, images, and\nsecrets.  \nIt simplifies common tasks like listing running containers, backing up and restoring volumes, retrieving Docker image\ntags from Docker Hub, and securely managing secrets via Docker volumes.\n\n## Installation\n\nYou can install dkrutil directly from PyPI:\n\n```bash\npip install dkrutil\n```\n\nFor isolated environments and ease of management, you can use `pipx`:\n\n```bash\npipx install dkrutil\n```\n\nOr install it using [uv](https://github.com/astral-sh/uv) for development:\n\n```bash\nuv pip install dkrutil\n```\n\n> [!WARNING]\n> Some `dkrutil` commands (e.g., **volume backups** and **secrets management**) require **root privileges**.  \n> If you installed `dkrutil` in a user-local directory (e.g., `~/.local/bin` via `pip` or `pipx`), make sure the `dkrutil` binary is > accessible to `root`.  \n> For example:\n> ```\n> sudo cp ~/.local/bin/dkrutil /usr/local/bin/\n> ```\n> This ensures `dkrutil` can be used in scripts or commands requiring `sudo`.\n\n## Usage\n\nDkrutil provides the `dkrutil` command with various subcommands.\n\n### Containers\n\n#### List running containers\n\n```bash\ndkrutil container ps\n```\n\nOptions:\n\n- `-a, --all` \u2192 Show all containers, including stopped ones.\n\n### Volumes\n\n#### Backup Docker volumes\n\n```bash\ndkrutil volume backup -d /path/to/backup\n```\n\nOptions:\n\n- `-d, --backup-directory` \u2192 Directory where the volumes will be backed up.\n- `-i, --include` \u2192 Regex pattern to include specific volumes (can be repeated).\n- `-I, --ignore` \u2192 Regex pattern to ignore specific volumes (can be repeated).\n- `-v, --verbose` \u2192 Show skipped volumes in real time.\n\n#### Restore Docker volumes\n\n```bash\ndkrutil volume restore -d /path/to/backup\n```\n\nOptions:\n\n- `-d, --backup-directory` \u2192 Directory containing the backup files.\n\n### Images\n\n#### Retrieve all tags of an image\n\n```bash\ndkrutil image tags alpine\n```\n\nOptions:\n\n- `-d, --digest` \u2192 Filter tags by a specific SHA256 digest.\n- `-t, --tag` \u2192 Retrieve the digest of a specific tag.\n\n### Secrets\n\n#### Create a secret stored in a Docker volume\n\n```bash\ndkrutil secret create <name> [FILE|-]\n```\n\nThis command stores a secret securely inside a Docker named volume.\n\n- If `FILE` is omitted or set to `-`, the content is read from standard input.\n- A file named `<name>` will be created inside the volume `<name>` with the secret content.\n- If the volume already exists, the command will fail (no overwrite).\n\nExamples:\n\n```bash\n# From a file\ndkrutil secret create db_password ./my-password.txt\n\n# From stdin\necho \"supersecret\" | dkrutil secret create db_password\n```\n\n## Configuration\n\nDkrutil uses the `docker` Python library to interact with the Docker API. Ensure Docker is installed and running\nbefore using this tool.\n\n## Development\n\nClone the repository:\n\n```bash\ngit clone https://github.com/emerick-biron/dkrutil.git\ncd dkrutil\n```\n\nInstall dependencies with uv:\n\n```bash\nuv pip install -e .\n```\n\nRun the tool locally:\n\n```bash\ndkrutil --help\n```\n\nBuild the package:\n\n```bash\nuv build\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A command-line tool for managing Docker containers, volumes, images, and secrets",
    "version": "1.0.5",
    "project_urls": {
        "Changelog": "https://github.com/emerick-biron/dkrutil/releases",
        "Homepage": "https://github.com/emerick-biron/dkrutil",
        "Issues": "https://github.com/emerick-biron/dkrutil/issues",
        "Repository": "https://github.com/emerick-biron/dkrutil"
    },
    "split_keywords": [
        "backup",
        " cli",
        " container",
        " devops",
        " docker",
        " secrets",
        " volume"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5a7204753bbf143b6e85f699586c6ee80b33666b045bf8f50eb8dcb88a024a60",
                "md5": "dc37a042c84f531a862b807d01b58f2a",
                "sha256": "db717c25659a78ec8e613e8ea0d89cb3c32e219194dbe9a717d03174c039c27c"
            },
            "downloads": -1,
            "filename": "dkrutil-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc37a042c84f531a862b807d01b58f2a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 9966,
            "upload_time": "2025-10-26T22:15:14",
            "upload_time_iso_8601": "2025-10-26T22:15:14.767037Z",
            "url": "https://files.pythonhosted.org/packages/5a/72/04753bbf143b6e85f699586c6ee80b33666b045bf8f50eb8dcb88a024a60/dkrutil-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0ee43940b7ccae028822044f713fddce007ca878fead3ff461af25bfe0190f9b",
                "md5": "96ec515503be86f1e0e64a33d6f12a7e",
                "sha256": "538dd544a164540b865cb629f929fa6d4a9f3e590a881511df1f1022d2b6b33b"
            },
            "downloads": -1,
            "filename": "dkrutil-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "96ec515503be86f1e0e64a33d6f12a7e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 9521,
            "upload_time": "2025-10-26T22:15:15",
            "upload_time_iso_8601": "2025-10-26T22:15:15.807246Z",
            "url": "https://files.pythonhosted.org/packages/0e/e4/3940b7ccae028822044f713fddce007ca878fead3ff461af25bfe0190f9b/dkrutil-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-26 22:15:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "emerick-biron",
    "github_project": "dkrutil",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dkrutil"
}