[Enhancement]: Allow disabling resource cleanup entirely (no Ryuk, no JVM shutdown hook)

Aperta
#12,195 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
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, github-actions, java
Ambito
devops, testing

Direzione di ricerca

Start by locating ResourceReaper.instance() and JVMHookResourceReaper, then trace how TESTCONTAINERS_RYUK_DISABLED and testcontainers.properties values are loaded. Identify the existing tests for resource-reaper selection and add coverage for a no-op mode. The work is done when a supported configuration can disable both Ryuk and the JVM shutdown hook while preserving the existing cleanup modes.

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

Descrizione

type/enhancement
Module

Core

Proposal
Problem

On ephemeral CI runners, Testcontainers' resource cleanup is unnecessary: the whole VM is discarded when the job ends. Setting TESTCONTAINERS_RYUK_DISABLED=true does not turn cleanup off; it switches ResourceReaper.instance() to JVMHookResourceReaper, which on JVM shutdown runs label-filtered docker {network,volume,image} prune calls.

We ran into an issue when upgrading our GitHub Actions runners to Ubuntu 26.04 with Docker 29 and the containerd image store. Our backend build failed in ~36% of runs with image-pull errors like:

failed commit on ref ... no such file or directory

Our hypothesis is moby/moby#53321: an image prune on the containerd store can drop leases of in-progress pulls, even pulls of images that don't match the prune's label filter. So each test JVM exiting can break pulls of other JVMs still running. After re-enabling Ryuk (which removes images individually via ImageRemove, not via prune, the problem disappeared.

Discussion #12085 ("unknown blob" errors with parallel builds) may be related, but its setup differs and there's no confirmed link.

Proposal

Provide a supported way to skip cleanup completely, e.g. an environment variable / testcontainers.properties entry such as TESTCONTAINERS_RESOURCE_REAPER=none (alongside the implicit ryuk / jvm-hook), selecting a no-op ResourceReaper.

Benefit

Ephemeral CI avoids the Ryuk container and its startup cost without falling back to the shutdown-hook prune.

Lingua principale
Java
Stelle
8.8k
Fork
2k
Merge medio
2g 1h
PR unite (30g)
11

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-java

Tutte le issue di testcontainers/testcontainers-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.