i bind a volume to my GenericContainer as follows:
@Container
public GenericContainer ap = new GenericContainer(DockerImageName.parse("myImage:latest"))
.withExposedPorts(AP_PORT)
.withEnv("SPRING_PROFILES_ACTIVE", "integrationtest")
.withFileSystemBind("/home/user/tmp/rdf4jRepos/", "/mnt/spring/", BindMode.READ_WRITE)
.withLogConsumer(new Slf4jLogConsumer(log))
.waitingFor(Wait.forHttp("/actuator/health"));
But i've a permission denied problem. I added the following into the spring-boot app, that runs in the GenericContainer: (rdfRepositoryHome = /mnt/spring)
File repoHome = new File(rdfRepositoryHome);
System.out.println( "getAbsolutePath: " + repoHome.getAbsolutePath());
File f2 = new File(repoHome, "testRepo");
System.out.println( "repoHome.isDirectory(): " + repoHome.isDirectory() );
System.out.println( "Execute: " + repoHome.canExecute() );
System.out.println( "Write: " + repoHome.canWrite() );
System.out.println( "READ: " + repoHome.canRead() );
output:
2021-08-04 16:11:31.566 INFO 326439 --- [tream-274971679] d.f.i.s.p.a.i.ITReadProfile : STDOUT: getAbsolutePath: /mnt/spring
2021-08-04 16:11:31.567 INFO 326439 --- [tream-274971679] d.f.i.s.p.a.i.ITReadProfile : STDOUT: repoHome.isDirectory(): true
2021-08-04 16:11:31.567 INFO 326439 --- [tream-274971679] d.f.i.s.p.a.i.ITReadProfile : STDOUT: Execute: true
2021-08-04 16:11:31.567 INFO 326439 --- [tream-274971679] d.f.i.s.p.a.i.ITReadProfile : STDOUT: Write: false
2021-08-04 16:11:31.567 INFO 326439 --- [tream-274971679] d.f.i.s.p.a.i.ITReadProfile : STDOUT: READ: true
How can i bind a volume, that is writable?
Thanks
Update 19.08.2021:
I added a test to another project, that is public available:
Running on image:
maven:3.6.1-jdk-11
Update 30.8.2021:
The problem should be reproducable (independent from gitlab ci and DinD!) with
git clone https://gitlab.com/linkedopenactors/loa-suite.git
git checkout feature/testcontainer
cd loa-suite/
mvn clean install -DskipTests
cd integrationtests/
mvn -Dit.test=ITLastSync verify