Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add an escape hatch for raw container create options

Aperta
#1,550 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, typescript
Ambito
backend, devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
TypeScript
Stelle
2.6k
Fork
274
Merge medio
1g 14h
PR unite (30g)
44

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testcontainers/testcontainers-node

Tutte le issue di testcontainers/testcontainers-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.