testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

`ImageFromDockerfile` not working when `withFileFromFile` and `withDockerfile` are used at the same time

Open MarconZet opened this issue 4 years ago • 1 comments

Issue

This works as expected

new ImageFromDockerfile(imageName, true)
    .withFileFromFile("Dockerfile", new File("dev/keycloak/Dockerfile"))
    .withFileFromFile("dev/keycloak/sbt-project", new File("dev/keycloak/sbt-project"))

while this fails to create image and deadlocks on PipedInputStream#awaitSpace()

new ImageFromDockerfile(imageName, true)
    .withDockerfile(new File("dev/keycloak/Dockerfile").toPath)
    .withFileFromFile("dev/keycloak/sbt-project", new File("dev/keycloak/sbt-project"))

Expected result

At least some kind of warning or exception

MarconZet avatar Nov 24 '21 13:11 MarconZet

Since this unexpected behavior re-surfaces time and time again, I think the issue here is, that withDockerfile() generally does not honor the user specified context. I am not sure if this originates in our upstream integration with docker-java, I did not find the issue in our code on a first glance.

kiview avatar Oct 08 '24 07:10 kiview