A lightweight Python package for managing Docker images and running containers with ease.
Project description
DockerCor
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:
pip install dockercor
Or using Poetry:
poetry add dockercor
Usage
Command Line Interface
# 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
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:
- Clone the repository:
git clone https://github.com/infocornouaille/dockercor.git
cd dockercor
- Install dependencies:
poetry install
- Run tests:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dockercor-0.1.1.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for dockercor-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8793ca722c9f88ad62494957ebc47a04fed043fe4784a7c489a7ff5c0ed792aa |
|
MD5 | eebfc98643c7708bc525acc3da526c04 |
|
BLAKE2b-256 | 5c7cd64245c83e000474ed86b17e49c6d0d5416d05c32d6bb41f7a71af822984 |