title: Docker: copy file and directory with docker-compose
body: <p>I created one Docker Image for a custom application which needs some license files (some files and one directory) to run, so I'm using the COPY command in the <code>Dockerfile</code> to copy license file to the image:</p>
  
  <pre><code># Base image: Application installed on Debian 10 but unlicensed
  FROM me/application-unlicensed
  
  # Copy license files
  COPY *.license /opt/application/
  COPY application-license-dir /var/lib/application-license-dir
  </code></pre>
  
  <p>I use this <code>Dockerfile</code> to build a new image with the license for a single container. As I have 5 different licenses I created 5 different images each with one specific license file and directory.</p>
  
  <p>The licenses are also fixed to a <strong>MAC Address</strong>, so when I run one of the five container I specify its own MAC Address with the <code>--mac-address</code> parameter:</p>
  
  <pre><code>docker run --rm --mac-address AB:CD:EF:12:34:56 me/application-license1
  </code></pre>
  
  <p>This work, but I wish to have a better and smarter way to manage this:</p>
  
  <p>As with <code>docker-compose</code> is it possible to specify the container MAC Address, could I just use the unlicensed base image and copy license files and the license directory when I build the 5 containers with <code>docker-compose</code>?</p>
  
  <hr>
  
  <p><strong>Edit: let me better explain the structure of license files</strong></p>
  
  <p>The application is deployed into <code>/opt/application</code> directory into the Docker image.</p>
  
  <p>License files (<code>*.license</code>) are into the <code>/opt/application</code> at the same level of the application itself, to they cannot be saved into a Docker volume unless I create some symlinks (but I have to check if the application will work this way).</p>
  
  <p>The directory application-license-dir needs to be at <code>/var/lib/application-license-dir</code>, so it can be mounted into a Docker volume (I have to check if the application will work but I think so).</p>
  
  <p>Both <code>*.license</code> files and the files into the <code>application-license-dir</code> are binary, so I cannot script or create them at runtime.</p>
  
  <p>So:</p>
  
  <ol>
  <li>can <code>docker-compose</code> create a local directory on the Docker host
  server before binding and mounting it to a Docker volume?</li>
  <li>can <code>docker-compose</code> copy my licenses file and my license directory from
  the GIT repository (locally cloned) to the local directory created
  during the step 1?</li>
  <li>can <code>docker-compose</code> create some symlinks into the
  container's <code>/opt/application</code> directory for the <code>*.license</code> files
  stored into the volume?</li>
  </ol>