This release is a pre-release and may not be stable for production use.
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.
Release files for container-tester 1.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| container_tester-1.0.0rc1.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| container_tester-1.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.1 kB
Release files / container_tester-1.0.0rc1.tar.gz
| Download URL | container_tester-1.0.0rc1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55684cfc313cd98f987ca932e1bc2c96d502f3364dda7917c3e612e45247ceeb
|
|
BLAKE2b-256 checksum How to use checksums |
2046eafc8522f33fd350d93d7b4a30c7e4b89c461c7885c9e747f15932bed0b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 18, 2025.
Transparency logRelease files / container_tester-1.0.0rc1-py3-none-any.whl
| Download URL | container_tester-1.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
578fbba74f9380ead273438072989c411bb49bf0c1fad08dd048d90cece9f206
|
|
BLAKE2b-256 checksum How to use checksums |
bd35e96efc865c773558e6591ff71511a7eb5617442a030db6733bbd79e9c7d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 18, 2025.
Transparency log