testcontainers / testcontainers/testcontainers-java

GenericContainer#isHealthy throws NPE if the healthcheck is not set

Open
#2,205 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Looks like health state is no longer part of the docker inspect response (api v1.40).

image

Looks like docker-java is mistakenly returning it in the response so we can't rely on that:
https://github.com/docker-java/docker-java/blob/066f268fa4f88687a9e7a41ca5eeaa85d63d8455/docker-java-api/src/main/java/com/github/dockerjava/api/command/InspectContainerResponse.java#L336-L340


Reproducer: https://github.com/testcontainers/testcontainers-java/pull/2204

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 GenericContainer#isHealthy and the Docker inspect response handling described in the issue, then run or inspect the reproducer in pull request #2204. Compare behavior when no healthcheck is configured with the Docker API v1.40 response. Done means GenericContainer#isHealthy no longer throws a NullPointerException in that case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.