testcontainers / testcontainers/testcontainers-java

GenericContainer fails to start when exposing ports on certain OSes

Open
#1,978 13 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Simple test case in JUnit 4, Java 8:

import lombok.val;
import org.junit.Test;
import org.testcontainers.containers.GenericContainer;

public class BoomTest {
  @Test
  public void notBoom() {
    val container = new GenericContainer("mongo:4.2.0-bionic").withExposedPorts(27017);
    container.start();
    System.out.println("Hello world");
  }
}

Using testcontainers version 1.12.2 will fail, timing out on start, but only on certain systems: fresh Arch and Void linux systems will fail on this, fresh Debian seemingly is fine.

Downgrading to version 1.10.7 works

---- edited by @bsideup ----
So the problem appear to be caused by #1318 and has a downstream dependency https://github.com/docker-java/docker-java/issues/1259

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 the inline BoomTest reproduction using GenericContainer("mongo:4.2.0-bionic").withExposedPorts(27017), comparing Testcontainers 1.12.2 with 1.10.7 on the reported Arch, Void, and Debian systems. Read the context from #1318 and docker-java issue #1259; done means the container starts reliably with exposed ports on the affected systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
devops, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.