<p>I am exercising on K8S, and I need to share some data between my containers inside a POD, the problem I have is that I need to make containers have available some data from other containers that is already present on that containers at startup. Let me show an example of what I mean:</p>
<p>Container A at startup:
<code>/root/dir/a.txt</code>
Container B at startup <code>/root/dirB/b.txt</code></p>
<p>In container C I want to have a directory that contains both a.txt file and b.txt file without doing any operation such as writing etc. But just using volumes.
How can I do it?
Thank you in advance</p>

Luigi De Marco
<p>Make a emptyDir volume, mount it at <code>/newroot</code> on both A and B with both of those set as initContainers which will run <code>command: [bash, -c, &quot;cp /root/dir/a.txt /newroot/dir/a.txt]</code> and similar for B. On C mount that emptyDir using <code>subPath</code> on either <code>/root/dir</code> or the whole path as needed.</p>
