<p>I've been searching and every answer seems to be the same example (<a href="https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/</a>). In a pod you can create an empty volume, then mount that into two containers and any content written in that mount will be seen on each container.  While this is fine my use case is slightly different.</p>
<p>Container A
/opt/content</p>
<p>Container B
/data</p>
<p>Container A has an install of about 4G of data.  What I would like to do is mount /opt/content into Container B at /content. This way the 4G of data is accessible to Container B at runtime and I don't have to copy content or specially build Container B.</p>
<p>My question, is this possible. If it is, what would be the proper pod syntax.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: two-containers
spec:

  restartPolicy: Never

  volumes:
  - name: shared-data
    emptyDir: {}

  containers:

  - name: nginx-container
    image: nginx
    volumeMounts:
    - name: shared-data
      mountPath: /opt/content

  - name: debian-container
    image: debian
    volumeMounts:
    - name: shared-data
      mountPath: /content
</code></pre>

Stephen Paulin
<p>From my research and testing the best I can tell is within a POD two containers can not see each others file system.  The volume mount will allow each container to have a mount created in the pod to the specified path (as the example shows) and then any items written to it after that point, will be seen on both.  This works great for logs and stuff.</p>
<p>In my context, this proves to not be possible and creating this mount, and then having Container A copy the 4G directory to the newly created mount is to time consuming to make this an option.</p>
<p>Best I can tell is the only way to do this is create a Persistent Volume or other similar and mount that in the Container B.  This way Container A contents are stored in the Persistent Volume and it can be easily mounted when needed.  The only issue with this is the Persistent Volume will have to be setup in every Kube cluster defined which is the pain point.</p>
<p>If any of this is wrong and I just didn't find the right document please correct me. I would love to be able to do this.</p>
