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

Expose host ports per container instead of globally

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

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

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

評価

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

調査の方向性

Read start and startContainer in packages/testcontainers/src/generic-container/generic-container.ts, then trace host access through packages/testcontainers/src/port-forwarder/port-forwarder.ts and packages/testcontainers/src/test-containers.ts. Check how the request affects reuse hashing and coordinate with #1520 and #1522. Done means a container can opt in with withExposedHostPorts(...ports), unrequested containers stay unaffected, and the existing global call continues to work.

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

説明

enhancement minor

What happens

TestContainers.exposeHostPorts(...ports) is global and permanent. Once it has been called, every container started afterwards in the process:

  • is connected to the port forwarder's network, in addition to its own
  • gets a host.testcontainers.internal entry in its extra hosts

whether or not it needs to reach the host. A container cannot opt out, and exposure cannot be scoped to one test. The extra network shows up in getNetworkNames().

Expected

Host access is requested per container, for example withExposedHostPorts(...ports). Containers that did not ask are left alone. The global call keeps working.

Where

  • start and startContainer in packages/testcontainers/src/generic-container/generic-container.ts
  • packages/testcontainers/src/port-forwarder/port-forwarder.ts
  • packages/testcontainers/src/test-containers.ts

Notes

  • Java keeps the global Testcontainers.exposeHostPorts(...) and makes containers opt in with withAccessToHost(true). Go's WithHostPortAccess(ports...) is per container.
  • Related: #1188.
  • Changing the global call so that containers no longer get host access by default would be major. Adding the per-container form is minor.

Dependencies

  • Stack on #1520: the host-access wiring is in start(), where it is one of the things that accumulates.
  • Coordinate with #1522: host access changes the create request, so it affects the reuse hash.
主要言語
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 を短くまとめたダイジェスト。