Skip to content

Conversation

@bedla
Copy link
Contributor

@bedla bedla commented Sep 28, 2025

Hi,
I found out that, when I run Testcontainers using GraalVM native build and I want to have support for MountableFile from class path, it fails with following exception.
I was digging deeper and find out that it is because resources loaded using class-loader have "non-standard" File path with prefix resource: and that's why it cannot be mounted with usual code already presented in TC.
What I found out is that resource should be extracted to temp directory as we already do with .jar resources, and then mounted as usual.
I would like to write tests for this, but GraalVM is needed to make it reproducible. Do you have somewhere tests for GraalVM to point me to for inspiration?
What do you think about this change?
Thank you
Ivos

issue here #10191


Problem with mounting-supported-check in methow org.testcontainers.DockerClientFactory#checkMountableFile

Exception in thread "main" com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: mount denied: the source path "resource:/org/example/Main.class:/dummy:ro" too many colons

        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:37)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:13)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.CreateContainerCmdImpl.exec(CreateContainerCmdImpl.java:608)
        at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:364)
        at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:351)
        at org.example.Main.checkMountableFile(Main.java:53)
        at org.example.Main.main(Main.java:37)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

@bedla bedla requested a review from a team as a code owner September 28, 2025 18:25
@bedla bedla force-pushed the feature/graalvm-native-mountablefile-support branch from a22a943 to 48cdfcb Compare December 10, 2025 20:06
We extract resource to temp path and then mount this path, as we already do with .jar resources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant