testcontainers / testcontainers/testcontainers-java

ImageFromDockerfile does not support container reuse

Open
#3,831 10 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

After updating to the 1.15.1 version of testcontainers I've noticed an issue, when trying to reuse containers for subsequent runs. I'm creating an image using ImageFromDockerfile, but it defines an image with "default" labels, that includes TESTCONTAINERS_SESSION_ID_LABEL. As far as I've checked, there is no way to not to inherit labels when creating a container using docker, which means, that container also contains this label and is removed by ryuk after test run. The commit that added "default" labels is this one: https://github.com/testcontainers/testcontainers-java/commit/6ac18b2b882f4c1a8b5d550d9ca79de339ce0265

Contributor guide

Open the contributing guide

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.

Research direction

Start with ImageFromDockerfile and the linked commit that introduced the default labels. Reproduce container reuse with Ryuk enabled, then trace how TESTCONTAINERS_SESSION_ID_LABEL reaches the built image and subsequent container. Done means reused containers are not incorrectly removed by Ryuk; verify with the relevant existing reuse or ImageFromDockerfile tests if available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.