| Crates.io | testcontainers-modules |
| lib.rs | testcontainers-modules |
| version | 0.13.0 |
| created_at | 2023-06-19 17:04:28.520388+00 |
| updated_at | 2025-08-27 04:41:58.268688+00 |
| description | Community maintained modules for Testcontainers for Rust |
| homepage | |
| repository | https://github.com/testcontainers/testcontainers-rs-modules-community |
| max_upload_size | |
| id | 894252 |
| size | 706,591 |
Community maintained modules for testcontainers
Provides modules to use for testing components in accordance with testcontainers-rs. Every module is treated as a feature inside this crate.
postgres, minio and etc)
blocking feature if you want to use modules within synchronous tests (feature-gate for SyncRunner)AsyncRunner or SyncRunnerSimple example of using postgres module with SyncRunner (blocking and postgres features enabled):
use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};
#[test]
fn test_with_postgres() {
let container = postgres::Postgres::default().start().unwrap();
let host_ip = container.get_host().unwrap();
let host_port = container.get_host_port_ipv4(5432).unwrap();
}
Note: you don't need to explicitly depend on testcontainers as it's re-exported dependency
of testcontainers-modules with aligned version between these crates.
For example:
use testcontainers_modules::testcontainers::ImageExt;
You can also see examples for more details.
Just use RunnableImage:
use testcontainers_modules::{
redis::Redis,
testcontainers::{ContainerRequest, ImageExt}
};
/// Create a Redis module with `6.2-alpine` tag and custom password
fn create_redis() -> ContainerRequest<Redis> {
Redis::default()
.with_tag("6.2-alpine")
.with_env_var("REDIS_PASSWORD", "my_secret_password")
}