testcontainers / testcontainers/testcontainers-java

Container from dockerfile won't build over missing file for copy

Open
#3,218 2 comments 3 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

Dear maintainers

I'm currently using testcontainers 1.14.3

Following instructions from https://www.testcontainers.org/features/creating_images/, the following code won't produce a valid docker image

new ImageFromDockerfile(IMAGE + ":" + RandomStringUtils.randomAlphabetic(15))
						.withFileFromPath(".", dockerfile)
						.withDockerfile(Paths.get("load/Dockerfile"))

Log states

COPY failed: stat /var/lib/docker/tmp/docker-builder795849804/load: no such file or directory

while dockerfile path points to a directory containing ./load

I don't get any message showing that content is sent to docker build context, why .withFileFromPath(".", dockerfile) isn't catching anything?
What am I doing wrong?

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 documented creating-images example, then reproduce the provided withFileFromPath and withDockerfile setup using load/Dockerfile. Inspect the Docker build context and confirm that the referenced load directory is included; the issue is done when the COPY step succeeds and produces a valid image.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.