testcontainers / testcontainers/testcontainers-java

DockerComposeContainer doesn't report underlying issue on start failure.

Open
#5,126 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/docker-compose resolution/acknowledged type/enhancement
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

This isn't necessarily a bug but it seems like its a gap in the start up error reporting.

When starting up a test containers, it's failing with the following "Caused by" stacktrace:

Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
... 150 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:525)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 151 more
Caused by: java.lang.IllegalStateException: Container did not start correctly.
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:463)
... 153 more

None of this is particularly informative.

When directly starting up docker with the same docker-compose.yml, this was reported:

docker-compose -f docker-compose.yml up -d
[+] Running 0/0
 ⠿ Network appevents-provisioner_default  Error                                0.0s
failed to create network appevents-provisioner_default: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

Another member on our team directed me to docker network ls:

docker network ls
NETWORK ID     NAME                   DRIVER    SCOPE
1092d4876829   1eylvttsssuk_default   bridge    local
aa08e32c77c6   4fq4vqxbmq2e_default   bridge    local
b9cc9d2c02ea   4gtpimii42dc_default   bridge    local
6f9835452949   bbfhuyndyhge_default   bridge    local
1ae2f01181dd   bridge                 bridge    local
87d9755d65db   ckg9bdaghx2m_default   bridge    local
54bf8b4e66b4   drdafrr8vcuw_default   bridge    local
633a08e00dc8   egj2dr2nhju9_default   bridge    local
42706dd28d31   ghy6amkgx1qr_default   bridge    local
60e415e7890a   gjlmzqcqbyx1_default   bridge    local
8b788e8024a7   h7limppelzbm_default   bridge    local
f8143f373104   hg92szytffyx_default   bridge    local
a2cdb1b4f724   host                   host      local
ada646935572   ictsr19kolym_default   bridge    local
dd94b53a031a   isfskvbc5ixn_default   bridge    local
6cbc5196ca00   izx7kabwwwja_default   bridge    local
4c0fcf45402d   jmushtb7tbix_default   bridge    local
08749d2a7159   k4dugcecebye_default   bridge    local
180ac01fdc35   ks1bev5sildx_default   bridge    local
6ea09990ab86   local_default          bridge    local
9bfb392c156a   mnsecpxyfd9n_default   bridge    local
33f5e7d4a820   ndfqhau1lo1r_default   bridge    local
22ea5a41c9e7   none                   null      local
7c5106cbd5cb   owsqlsjrqmyp_default   bridge    local
d9abe014132f   puij6flbbupl_default   bridge    local
64251795e5ad   r8fq5rm7ny7i_default   bridge    local
b6cc47999a56   rd6mz2aw21vw_default   bridge    local
863c97bd163c   v8cetmwucp3c_default   bridge    local
da195e1d5c01   wdzbew1jmgb6_default   bridge    local
350928c753a5   wzeekb96naqr_default   bridge    local
7934aacf3e73   yjqlo6ve261q_default   bridge    local
dde63911c6ce   zg8uxue47oeh_default   bridge    local

So I googled and discovered "docker network prune -f"

It would have been helpful if the testcontainers start failure had explicitly said what the underlying problem was rather than just "Container did not start correctly."

Thanks,

-Jonathan

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 DockerComposeContainer and the GenericContainer startup path referenced in the stack trace, then compare its failure reporting with the docker-compose.yml command output shown in the issue. Identify where the underlying Docker error is lost and verify that a startup failure exposes that cause instead of only "Container did not start correctly."

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, 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.