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

Add an escape hatch for raw container create options

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

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

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

評価

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

調査の方向性

Read packages/testcontainers/src/generic-container/generic-container.ts and packages/testcontainers/src/test-container.ts, then trace where start() builds the Docker create request. Add the documented builder modifier so it runs last and works for modules; account for its output in the reuse hash as required by #1522, coordinating with #1520. Done when the modifier can set raw create options and the reuse hash reflects them.

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

説明

enhancement minor

What happens

A Docker create option that has no with* method can only be set by subclassing GenericContainer and writing to the protected createOpts or hostConfig:

class SysctlContainer extends GenericContainer {
  constructor(image: string) {
    super(image);
    this.hostConfig.Sysctls = { "net.core.somaxconn": "1024" };
  }
}

Options in this position today include Sysctls, Dns, Devices, ReadonlyRootfs, RestartPolicy, Init, PidMode and StopSignal. Each one otherwise needs a feature request and a release.

It also cannot be done for a module container without subclassing the module.

Expected

A documented escape hatch on the builder:

new GenericContainer(image).withCreateOptions((options) => {
  options.HostConfig.Sysctls = { "net.core.somaxconn": "1024" };
});

It runs last, after the library has built the request, and works on any container including modules.

Where

  • packages/testcontainers/src/generic-container/generic-container.ts
  • packages/testcontainers/src/test-container.ts

Notes

  • Java has withCreateContainerCmdModifier(Consumer<CreateContainerCmd>). Go has ConfigModifier, HostConfigModifier and EndpointSettingsModifier on the request, and has deprecated several dedicated fields in their favour.
  • This exposes Dockerode's types on purpose, in one clearly marked place. With an escape hatch, subclasses no longer need the protected createOpts and hostConfig fields.
  • The modifier's result must be part of the reuse hash (#1522).

Dependencies

  • Stack on #1520: the modifier runs where start() builds the create request, which that issue reworks.
  • Coordinate with #1522: the modifier's output has to be part of 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 を短くまとめたダイジェスト。