Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add an escape hatch for raw container create options

Abierto
#1,550 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, typescript
Área
backend, devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
2.6k
Forks
274
Merge medio
1 d 14 h
PR fusionados (30 d)
44

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de testcontainers/testcontainers-node

Todos los issues de testcontainers/testcontainers-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.