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

Address Compose containers by service name

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker-compose, typescript

調査の方向性

Start by reading packages/testcontainers/src/docker-compose-environment/docker-compose-environment.ts and started-docker-compose-environment.ts, then trace the compose name parsing entry point in packages/testcontainers/src/docker-runtime/clients/compose/parse-compose-container-name.ts. Check how containers are identified and how wait strategies and getContainer resolve them; done means those APIs accept service names with an optional replica index while retaining container-name support, and the constructor parameter is named for the directory it receives.

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

説明

enhancement minor

What happens

DockerComposeEnvironment identifies containers by container name, not by the service name written in the compose file:

const environment = await new DockerComposeEnvironment(dir, "docker-compose.yml")
  .withWaitStrategy("redis-1", Wait.forLogMessage("Ready to accept connections"))
  .up();

const redis = environment.getContainer("redis-1");
  • The -1 suffix is a Compose naming detail the user has to know.
  • A service with container_name: set is keyed by that name instead.
  • A wait strategy registered under the service name ("redis") matches nothing. up() now logs a warning for that case, and the docs carry a callout, but the default wait strategy is still what runs.
  • getContainer("redis") throws Cannot get container "redis" as it is not running.

The first constructor parameter is also misnamed: composeFilePath is the directory that contains the compose files, and the docs assign it "/path/to/build-context".

Expected

  • withWaitStrategy and getContainer accept a service name, with an optional replica index, and keep accepting a container name.
  • The constructor parameter is named for what it is.

Where

  • packages/testcontainers/src/docker-compose-environment/docker-compose-environment.ts
  • packages/testcontainers/src/docker-compose-environment/started-docker-compose-environment.ts
  • packages/testcontainers/src/container-runtime/clients/compose/parse-compose-container-name.ts

Notes

  • Java uses service names throughout: waitingFor(serviceName, strategy), getServiceHost(serviceName, port), getContainerByServiceName(serviceName), with an optional instance number on withExposedService. Go has ServiceContainer(ctx, svcName) and WaitForService(name, strategy).
  • Compose labels each container with com.docker.compose.service and com.docker.compose.container-number, so resolving a service does not need name parsing.
  • Related: #647.

Dependencies

  • Nothing blocks this. It can start now.
主要言語
TypeScript
スター
2.6k
フォーク
277
平均マージ
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 を短くまとめたダイジェスト。