[Feature]: Container startup attempt backoff strategy

Open
#9,479 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, java
Domain
testing

Research direction

The issue does not identify files, tests, or an entry point, so first trace the container startup attempt and retry handling used when constructing a container. Define the configurable backoff behavior, including exponential delays and its interaction with startup attempts and timeouts; done means contention can be retried with fewer logs while eventual startup remains possible.

Written by the indexing model from the issue text.

Description

type/feature
Module

None

Problem

I have a JUnit test extension that starts up a container. If multiple tests are executing in parallel in isolated JVMs, they contend for the container name and port bindings. One can work around this by giving it effectively infinite startup attempts and a reasonable startup timeout, but this generates excessive test logs from constant startup attempts.

Solution

Introduce a startup attempt backoff strategy option when constructing a container. Being able to exponentially backoff to a reasonable interval between startup attempts would help in reducing logs.

Benefit

This would benefit any situation where there is contention for exclusive resources between container instances, or any other situation where container startups are very flaky for an extended period, but eventual success is likely.

Alternatives

At the moment I'm using Awaitility to check for container name contention before attempting startup.

Would you like to help contributing this feature?

Yes

Dominant language
Java
Stars
8.8k
Forks
2k
Avg merge
2d 1h
Merged PRs (30d)
11

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from testcontainers/testcontainers-java

All issues in testcontainers/testcontainers-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.