testcontainers / testcontainers/testcontainers-java

Usage of `ImageFromDocker` not intuitive if `withDockerfile` is used

Open
#4,550 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When defining a GenericContainer using ImageFromDockerfile like this, the resulting build context will have a very unexpected structure (flattening all files in the build context root?), and building the image will fail if the user is not aware of it.

private final GenericContainer<?> container= new GenericContainer<>(
        new ImageFromDockerfile()
                .withDockerfile(Paths.get("src/main/docker/Dockerfile.jvm"))
                .withFileFromPath("./target", Paths.get("target/"))
);

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 ImageFromDockerfile entry point and the withDockerfile and withFileFromPath calls shown in the example. Reproduce the build using src/main/docker/Dockerfile.jvm and target/ to inspect the generated context. Done means the context structure is intuitive and the example builds successfully without requiring undocumented assumptions.

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.