Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Start a group of containers with dependencies and shared cleanup

オープン
#1,565 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker, node.js, typescript
領域
devtools, testing

調査の方向性

Read the existing GenericContainer and Network implementations under packages/testcontainers/src, then inspect how container startup and cleanup are handled. Design the group API from the issue’s sketch, including dependency ordering, parallel starts, shared network aliases, and stopping containers if a start fails; done means the group can start and dispose of a set of containers as described.

索引モデルが issue の本文から書いたものです。

説明

enhancement minor

What happens

A test that needs several containers wires them up by hand:

const network = await new Network().start();
const db = await new PostgreSqlContainer(dbImage).withNetwork(network).withNetworkAliases("db").start();
const app = await new GenericContainer(appImage)
  .withNetwork(network)
  .withEnvironment({ DATABASE_URL: "postgres://test:test@db:5432/test" })
  .withExposedPorts(8080)
  .start();
// ...
await app.stop();
await db.stop();
await network.stop();
  • 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 = await new ContainerGroup()
  .with("db", new PostgreSqlContainer(dbImage))
  .with("app", new GenericContainer(appImage).withExposedPorts(8080), { dependsOn: ["db"] })
  .start();

const app = 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.
  • The API shape above is a sketch.

Dependencies

  • Nothing blocks this. It can start now.
  • Coordinate with #1536: a group puts its containers on a network with aliases.
  • Coordinate with #1520: a group starts builders it was handed, so start() must not change them.
主要言語
TypeScript
スター
2.6k
フォーク
274
平均マージ
1日 14時間
マージ済み PR(30日)
44

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testcontainers/testcontainers-node のほかの issue

testcontainers/testcontainers-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。