Skip to main content

No project description provided

Project description

DockerCor

PyPI version Python 3.12+ License: MIT Code style: 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:

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:

  1. Clone the repository:
git clone https://github.com/infocornouaille/dockercor.git
cd dockercor
  1. Install dependencies:
poetry install
  1. 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


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.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

dockercor-0.1.0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page