Generate multiple docker cointainers to test projects
Project description
Container-tester
Overview
Container-Tester is a small Python utility that helps you test your project on top of many different Linux distributions without having to run and maintain lots of Docker tests yourself. It provides a command-line interface (CLI) that can:
- Build that Dockerfile into a image and report its size and metadata.
- Run a container from that image, execute a command inside it and capture the logs.
- Optionally clean up images and containers when you are done.
- Iterate over a curated list of popular Python, Debian/Ubuntu, Fedora and
Alpine base images defined in
docker-config.tomland perform the above steps for each of them.
Installation
You can use Container-Tester in two ways:
-
Install in your project:
uv add container-tester uv run contest --help # or if you don't want to install: uvx --from container-tester contest --help
Using Container-tester
Usage: contest [OPTIONS] [OS_NAME]
Generate, build, and run Docker resources from a base image or config file.
+- Options -------------------------------------------------------------------+
| --json --no-json Show output in json format |
| (use --json to enable) [default: no-json] |
| --pretty --no-pretty Show output in pretty format |
| (use --pretty to enable) [default: no-pretty] |
| --clean --no-clean Clean Docker resources after run |
| (use --clean to enable) [default: no-clean] |
| --install-completion Install completion for the current shell. |
| --show-completion Show completion for the current shell, to copy |
| it or customize the installation. |
| --help Show this message and exit. |
+-----------------------------------------------------------------------------+
+- Commands ------------------------------------------------------------------+
| test-config Generate, build, and run Docker resources from a docker |
| test-container Generate, build, and run Docker resources from a base image.|
+-----------------------------------------------------------------------------+
Example
Here is a quick example that runs a simple command across all default profiles:
uv run contest test-config
To test only on the Ubuntu image, you can specify its base image directly and use a custom command:
uv run contest test-container ubuntu:latest --command "echo Hello, world!"
Default profiles
By default, Container-Tester comes with a handful of profiles covering common
Python, Debian/Ubuntu and Alpine base images. Each profile defines an
image_tag (used as the resulting image name) and the corresponding os_name.
A few of them are shown below- see src/container_tester/docker-config.toml for
the full list:
| image_tag | os_name |
|---|---|
| py312_trixie | python:3.12-slim-trixie |
| ubuntu_latest | ubuntu:latest |
| alpine_latest | alpine:latest |
Custom Docker Configuration
You can define your own docker-config.toml file to run custom Docker images
tailored to your needs. Use the following format to specify multiple profiles:
[py311_slim]
command = ""
os_name = "python:3.11-slim"
os_commands = []
pkg_manager = "apt"
[ubuntu_latest]
command = ""
os_name = "ubuntu:latest"
os_commands = ["apt-get update && apt-get install -y ca-certificates"]
pkg_manager = "apt"
# Add more profiles as needed...
Configuration Fields
command: Shell command to execute inside the containers.image_tag: A unique identifier for the Docker image profile.os_name: The name and tag of the Docker image to use.os_commands: A list of shell commands to run after container startup (optional).pkg_manager: The package manager used by the OS (e.g., apk, dnf, apt).
Run with Your Custom Config
After creating your docker-config.toml file, launch your custom Docker setup
by running:
uv run contest test-config
License
This project is licensed under the terms of the MIT license.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file container_tester-1.0.0rc0.tar.gz.
File metadata
- Download URL: container_tester-1.0.0rc0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62c261616ee0b2ee2b6023a375ba84c6088f3c9ab926f439080b79a9b46da831
|
|
| MD5 |
bf1843adb274f8fe318907336da63c45
|
|
| BLAKE2b-256 |
f834bfbda235d86905a9fa902ba8e454014dcb8ea9a18d383f5c5e28f78c7b14
|
Provenance
The following attestation bundles were made for container_tester-1.0.0rc0.tar.gz:
Publisher:
publish_all.yml on geopozo/container-tester
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
container_tester-1.0.0rc0.tar.gz -
Subject digest:
62c261616ee0b2ee2b6023a375ba84c6088f3c9ab926f439080b79a9b46da831 - Sigstore transparency entry: 771582639
- Sigstore integration time:
-
Permalink:
geopozo/container-tester@84353c3871badd210432f41f997d28225f86b5bd -
Branch / Tag:
refs/tags/v1.0.0rc0 - Owner: https://github.com/geopozo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_all.yml@84353c3871badd210432f41f997d28225f86b5bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file container_tester-1.0.0rc0-py3-none-any.whl.
File metadata
- Download URL: container_tester-1.0.0rc0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe10794ce85b1129a5e3bd8de2138092a65ba553b1b6614b0b9afbbd5ec86c84
|
|
| MD5 |
28d6a339c98e5825c86c81692340d159
|
|
| BLAKE2b-256 |
fd5d2adb4a5739f0a869b7bc88c3b6d3cf900ea46d34b09c5ce788a0ac21cd07
|
Provenance
The following attestation bundles were made for container_tester-1.0.0rc0-py3-none-any.whl:
Publisher:
publish_all.yml on geopozo/container-tester
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
container_tester-1.0.0rc0-py3-none-any.whl -
Subject digest:
fe10794ce85b1129a5e3bd8de2138092a65ba553b1b6614b0b9afbbd5ec86c84 - Sigstore transparency entry: 771582644
- Sigstore integration time:
-
Permalink:
geopozo/container-tester@84353c3871badd210432f41f997d28225f86b5bd -
Branch / Tag:
refs/tags/v1.0.0rc0 - Owner: https://github.com/geopozo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_all.yml@84353c3871badd210432f41f997d28225f86b5bd -
Trigger Event:
push
-
Statement type: