pypi / testcontainers
testcontainers
What changed in testcontainers 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.
1 breaking9 new APIs and options6 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inittestcontainers 416 changes
Breaking changes 1
Compose support was implemented for v2 with improved typing, which may affect existing Compose usage.
New APIs and options 9
Adds a CrateDB community module for using CrateDB with Testcontainers.
Kafka listener name and security protocol are configurable.
Useful compose options are now exposed.
MySQL, Cassandra, Kafka, and Trino now allow passing in a custom wait strategy string.
NATS now supports JetStream.
Adds ExecWaitStrategy as a wait strategy; Postgres is migrated from the deprecated decorator.
AsyncRedisContainer is supported.
Compose runs can target specific services.
Support for tc.host was added, and docker:dind was de-prioritised.
Fixes and other changes 6
Elasticsearch 9.x is now supported.
Python 3.14 is now supported.
Consumers no longer need to state that Python 4 is unsupported.
URLError was added to the exceptions handled while waiting for Elasticsearch.
A fix addressed flaky garbage collection that was resulting in testing errors.
The RabbitMQ readiness probe was fixed.