DATE:
AUTHOR:
The AtomicJar team
Testcontainers Desktop

Enable reusable containers with a single click

DATE:
AUTHOR: The AtomicJar team

Reusable containers are an experimental capability that delivers a useful performance optimization: by keeping containers running and allowing multiple tests to reuse the same container, it's possible to shave off container start times. However, reusable containers are not suited for CI usage, and therefore activating the capability on desktop requires setting the testcontainers.reuse.enable=true property in the local ~/.testcontainers.properties file.

With Testcontainers Desktop switching the "reuse" capability on and off is now as easy as clicking the corresponding option in the app's menu!

Please note that, as an experimental capability, the implementation of reusable containers currently differs across Testcontainers libraries:

  • Some Testcontainers languages do not yet implement reuse.

  • reuse in Testcontainers Java does not currently support networks, in the sense that they can change the container's configuration and prevent reuse. In turn, this can impact methods such as exposeHostPorts.

  • Testcontainers Go matches the container on req.Name alone, instead of its full configuration, and within a single package.

  • Testcontainers Node does not rely on the testcontainers.reuse.enable=true property, and therefore this feature will not deactivate reuse as expected.

  • While reuse will prevent Ryuk from cleaning-up containers, they still get stopped by regular lifecycle commands (e.g. close() or similar). In practice, this means they're best used via the singleton pattern.

Powered by LaunchNotes