Skip to content

TestContainers bind a file as a folder #848

@McKratt

Description

@McKratt

Hello Community,

I already look at those issues : #842 and #668 but non of them fix my problem.

So basically I have the same problem mentionned in those issues but I'm not inside a container, I'm simply on windows.

Here is the code I use to define my container :

    @ClassRule
    public static OracleContainer oracleContainer =
            (OracleContainer) new OracleContainer()
                    .withClasspathResourceMapping("init.sql",
                            "/docker-entrypoint-initdb.d/init.sql",
                            BindMode.READ_WRITE);

When I stop my test (debug mode) and go to the running container here is what I get :

root@a64a8dacd7a3:/docker-entrypoint-initdb.d# ls -la
total 8
drwxr-xr-x 1 root root 4096 Aug 29 09:23 .
drwxr-xr-x 1 root root 4096 Aug 29 09:23 ..
drwxr-xr-x 2 root root   40 Aug 29 09:11 init.sql

So my file is now a folder and my DB is not configured correctly.

I saw that on windows we probably need absolute path : https://stackoverflow.com/questions/34134343/single-file-volume-mounted-as-directory-in-docker

Is there any way to adapt testcontainer in that way ? Or should I proceed diferently ?

Technical Infos :
OS : Windows 10
Java version : 1.8.144
TestContainer version : 1.8.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions