You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start a group of containers with dependencies and shared cleanup #1565
Start order is whatever order the awaits are written in. Independent containers start one after another unless the test adds its own Promise.all.
With Promise.all, if one start() rejects the others keep running until Ryuk removes them at process exit.
Cleanup is one call per container, in the right order.
Expected
A way to declare a set of containers, their dependencies and a shared network, start them as a unit and dispose of them as a unit:
await using group=awaitnewContainerGroup().with("db",newPostgreSqlContainer(dbImage)).with("app",newGenericContainer(appImage).withExposedPorts(8080),{dependsOn: ["db"]}).start();constapp=group.get("app");
Containers without a dependency between them start in parallel.
Each name becomes a network alias on a network the group owns.
If any container fails to start, the ones already started are stopped.
Where
New code in packages/testcontainers/src, built on GenericContainer and Network.
Notes
Java has dependsOn(Startable...) on containers and Startables.deepStart(...) for parallel start.
DockerComposeEnvironment covers this when the setup lives in a compose file. This is for setups defined in code, including module containers.
Activity