title: How to copy executable file to Docker container using Testcontainers
body: <p>I'm trying to copy an executable initialization bash script <code>init.sh</code> to the Localstack Docker container created with Testcontainers (1.13.0) using the JUnit 5 module:</p>
  
  <pre><code>@Container
  static LocalStackContainer localStack = new LocalStackContainer("0.10.0")
    .withServices(S3)
    .withCopyFileToContainer(MountableFile.forClasspathResource("init.sh"), "/docker-entrypoint-initaws.d/init.sh");
  </code></pre>
  
  <p>But inside the created Docker container the file lacks the execute permission (checked with looking at the file permission using <code>docker exec -it ID /bin/sh</code>).</p>
  
  <p>On my machine the file has the following permission:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>I also tried copying this file with <code>.withClasspathResourceMapping()</code> but this takes a binding mode which only offers <code>READ_ONLY</code> or <code>READ_WRITE</code>.</p>