I'm trying to copy an executable initialization bash script init.sh
to the Localstack Docker container created with Testcontainers (1.13.0) using the JUnit 5 module:
@Container
static LocalStackContainer localStack = new LocalStackContainer("0.10.0")
.withServices(S3)
.withCopyFileToContainer(MountableFile.forClasspathResource("init.sh"), "/docker-entrypoint-initaws.d/init.sh");
But inside the created Docker container the file lacks the execute permission (checked with looking at the file permission using docker exec -it ID /bin/sh
).
On my machine the file has the following permission:
$ ls -al
total 16
drwxr-xr-x 4 xyz staff 128 Apr 16 20:51 .
drwxr-xr-x 4 xyz staff 128 Apr 16 08:43 ..
-rw-r--r-- 1 xyz staff 135 Apr 16 20:14 application.yml
-rwxr-xr-x 1 xyz staff 121 Apr 16 20:51 init.sh
I also tried copying this file with .withClasspathResourceMapping()
but this takes a binding mode which only offers READ_ONLY
or READ_WRITE
.