<p>I need to share a directory between two containers: myapp and monitoring and to achieve this I created an emptyDir: {} and then volumeMount on both the containers.</p>
<pre><code>spec:
      volumes:
        - name:  shared-data
          emptyDir: {}
      containers:
      - name: myapp
        volumeMounts:
          - name:  shared-data
            mountPath:  /etc/myapp/
      - name: monitoring
        volumeMounts:
          - name: shared-data
            mountPath: /var/read 
</code></pre>
<p>This works fine as the data I write to the shared-data directory is visible in both containers. However, the config file that is created when creating the container under /etc/myapp/myapp.config is hidden as the shared-data volume is mounted over /etc/myapp path (overlap).</p>
<p>How can I force the container to first mount the volume to /etc/myapp path and then cause the docker image to place the myapp.config file under the default path /etc/myapp except that it is the mounted volume thus allowing the config file to be accessible by the monitoring container under /var/read?</p>
<p>Summary: let the monitoring container read the /etc/myapp/myapp.config file sitting on myapp container.</p>
<p>Can anyone advice please?</p>

<p>Can you mount shared-data at /var/read in an init container and copy config file from /etc/myapp/myapp.config to /var/read?</p>
