testcontainers / testcontainers/testcontainers-java
[Containerd] IN_A_CONTAINER didn't set correctly in containers started up via containerd service
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
public static final boolean IN_A_CONTAINER = new File("/.dockerenv").exists();
testcontainers use '/.dockerenv' to decide if IN_A_CONTAINER is true or false.
But in the containers started by containerd, '/.dockerenv' does not exist, and it will lead to testcontainers to connect ryuk via localhost, and ryuk will failed to be connected.
Errors from maven log as below:
java.lang.IllegalStateException: Could not connect to Ryuk at localhost:49175
And the latest testcontainers 1.1.6.0 is used here.
Look forward to fixing for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the declaration of IN_A_CONTAINER and the code that connects to Ryuk. Reproduce the localhost connection failure when containers are started through containerd, then inspect existing container-runtime tests if available. Done means containerd-started containers detect their environment correctly and the Ryuk connection succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- devops, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100