Skip to main content

A lightweight Python package for managing Docker images and running containers with ease.

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.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

dockercor-0.1.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file dockercor-0.1.3.tar.gz.

File metadata

  • Download URL: dockercor-0.1.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.1.0

File hashes

Hashes for dockercor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fed48ab8d4a0d7f753ec4820dea38d110390699f24350f630e7411517eaa33b2
MD5 b510e31c0e5102591d1b44e42a8642ce
BLAKE2b-256 f55ff0b94db2b588f2c96618f04b2d1732d6f3b754b242fc06f1b59a23236afa

See more details on using hashes here.

File details

Details for the file dockercor-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: dockercor-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.1.0

File hashes

Hashes for dockercor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2a5e81da8751f8d33b05b7188879f5368cd211bbca4ad2fdebf3678b511118d7
MD5 2c1f15042b9d804f618c1f44d492939a
BLAKE2b-256 f26aacce4a9f7e76078b32629e5cc87296ed184f4959c91c4ec8cdea967bc824

See more details on using hashes here.

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