The `testcontainers-minio` library is a component of `testcontainers-python`, an active library designed for functional and integration testing with throwaway Docker containers. It simplifies the setup and teardown of MinIO object storage instances for tests. While `testcontainers-python` is currently at version 4.x.x, the `testcontainers-minio` module is at an early release candidate, `0.0.1rc1`. The parent project `testcontainers-python` maintains a frequent release cadence, continuously adding new features and bug fixes across its various modules.
pip install testcontainers[minio]Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `MinioContainer` to spin up a MinIO server, retrieve its connection details, and then use the `minio` client library to create a bucket, upload an object, and retrieve it. The container is automatically managed (started and stopped) using a `with` statement.
Consult the `testcontainers-python` CHANGELOG on GitHub for specific module changes before upgrading.
Create a new `minio.Minio` client object within each process where it's needed.
Ensure `MinioContainer` methods that construct a `Minio` client use keyword arguments for `access_key`, `secret_key`, etc., or update `minio` client calls if directly instantiating.
Migrate custom wait strategies to use the new `ExecWaitStrategy` or other `WaitStrategy` implementations where applicable.
Ensure `client.make_bucket(bucket_name)` is called and completes successfully before attempting object operations on that bucket.
Verify the image name and tag are correct (e.g., `minio/minio:RELEASE.2022-12-02T19-19-22Z`). Check Docker connectivity and ensure you are logged into Docker Hub if using private repositories. Run `docker pull minio/minio:RELEASE.2022-12-02T19-19-22Z` manually to diagnose.
Upgrade the `minio` client library to a recent version (`pip install --upgrade minio`). Alternatively, remove the `secure` argument if your MinIO instance is HTTP-only and the client's default behavior is to infer security.