# DockerCor
[![PyPI version](https://badge.fury.io/py/dockercor.svg)](https://badge.fury.io/py/dockercor)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
A lightweight Python package for managing Docker images and running containers with ease.
## Features
- Simple Docker image management
- Easy container command execution
- Docker image information retrieval
- Command-line interface using Typer
- Python API for script integration
## Installation
You can install DockerCor using pip:
```bash
pip install dockercor
```
Or using Poetry:
```bash
poetry add dockercor
```
## Usage
### Command Line Interface
```bash
# Ensure a Docker image is available locally
dockercor ensure-image ubuntu:latest
# Force update an image
dockercor ensure-image ubuntu:latest --force
# Run a command in a container
dockercor run ubuntu:latest echo "Hello from container"
# Get information about an image
dockercor info ubuntu:latest
```
### Python API
```python
from dockercor import ensure_docker_image, run_docker_command, get_image_info
# Ensure image is available
updated, message = ensure_docker_image("ubuntu:latest")
print(message)
# Run a command in container
run_docker_command(["echo", "Hello from container"], "ubuntu:latest")
# Get image information
image_info = get_image_info("ubuntu:latest")
if image_info:
print(f"Image ID: {image_info['id']}")
print(f"Size: {image_info['size']}")
```
## Development
This project uses Poetry for dependency management. To set up the development environment:
1. Clone the repository:
```bash
git clone https://github.com/infocornouaille/dockercor.git
cd dockercor
```
2. Install dependencies:
```bash
poetry install
```
3. Run tests:
```bash
poetry run pytest
```
## Requirements
- Python 3.12 or higher
- Docker installed and running on your system
- Poetry (for development)
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/infocornouaille/dockercor.git",
"name": "dockercor",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "infocornouaille",
"author_email": "90894019+infocornouaille@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/f5/5f/f0b94db2b588f2c96618f04b2d1732d6f3b754b242fc06f1b59a23236afa/dockercor-0.1.3.tar.gz",
"platform": null,
"description": "# DockerCor\n\n[![PyPI version](https://badge.fury.io/py/dockercor.svg)](https://badge.fury.io/py/dockercor)\n[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nA lightweight Python package for managing Docker images and running containers with ease.\n\n## Features\n\n- Simple Docker image management\n- Easy container command execution\n- Docker image information retrieval\n- Command-line interface using Typer\n- Python API for script integration\n\n## Installation\n\nYou can install DockerCor using pip:\n\n```bash\npip install dockercor\n```\n\nOr using Poetry:\n\n```bash\npoetry add dockercor\n```\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Ensure a Docker image is available locally\ndockercor ensure-image ubuntu:latest\n\n# Force update an image\ndockercor ensure-image ubuntu:latest --force\n\n# Run a command in a container\ndockercor run ubuntu:latest echo \"Hello from container\"\n\n# Get information about an image\ndockercor info ubuntu:latest\n```\n\n### Python API\n\n```python\nfrom dockercor import ensure_docker_image, run_docker_command, get_image_info\n\n# Ensure image is available\nupdated, message = ensure_docker_image(\"ubuntu:latest\")\nprint(message)\n\n# Run a command in container\nrun_docker_command([\"echo\", \"Hello from container\"], \"ubuntu:latest\")\n\n# Get image information\nimage_info = get_image_info(\"ubuntu:latest\")\nif image_info:\n print(f\"Image ID: {image_info['id']}\")\n print(f\"Size: {image_info['size']}\")\n```\n\n## Development\n\nThis project uses Poetry for dependency management. To set up the development environment:\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/infocornouaille/dockercor.git\ncd dockercor\n```\n\n2. Install dependencies:\n```bash\npoetry install\n```\n\n3. Run tests:\n```bash\npoetry run pytest\n```\n\n## Requirements\n\n- Python 3.12 or higher\n- Docker installed and running on your system\n- Poetry (for development)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A lightweight Python package for managing Docker images and running containers with ease.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/infocornouaille/dockercor.git",
"Repository": "https://github.com/infocornouaille/dockercor.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f26aacce4a9f7e76078b32629e5cc87296ed184f4959c91c4ec8cdea967bc824",
"md5": "2c1f15042b9d804f618c1f44d492939a",
"sha256": "2a5e81da8751f8d33b05b7188879f5368cd211bbca4ad2fdebf3678b511118d7"
},
"downloads": -1,
"filename": "dockercor-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c1f15042b9d804f618c1f44d492939a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 5614,
"upload_time": "2024-11-05T15:59:36",
"upload_time_iso_8601": "2024-11-05T15:59:36.699426Z",
"url": "https://files.pythonhosted.org/packages/f2/6a/acce4a9f7e76078b32629e5cc87296ed184f4959c91c4ec8cdea967bc824/dockercor-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f55ff0b94db2b588f2c96618f04b2d1732d6f3b754b242fc06f1b59a23236afa",
"md5": "b510e31c0e5102591d1b44e42a8642ce",
"sha256": "fed48ab8d4a0d7f753ec4820dea38d110390699f24350f630e7411517eaa33b2"
},
"downloads": -1,
"filename": "dockercor-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "b510e31c0e5102591d1b44e42a8642ce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 4357,
"upload_time": "2024-11-05T15:59:38",
"upload_time_iso_8601": "2024-11-05T15:59:38.086153Z",
"url": "https://files.pythonhosted.org/packages/f5/5f/f0b94db2b588f2c96618f04b2d1732d6f3b754b242fc06f1b59a23236afa/dockercor-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-05 15:59:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "infocornouaille",
"github_project": "dockercor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dockercor"
}