Inside container's mount path Folder no file present only lost+found directory

We have scenario where we are building the image Dockerfile where inside Dockerfile we are copying the local folder into the image one is code folder and another is product folder /apps/pub/crx-quickstart and this path is mounted with local storage. when i am creating a POD inside kubernetes cluster inside mount path /apps/pub/crx-quickstart no files and folder and it is showing lost+found directory.

I am struggling from last 3 days and unable to solve it. Please help

I’m afraid that it’s normal behavior. If you mount something to the path the original content will be hidden. There is nothing to merge your data from the docker image with the data on the volume. Do you try mounting it as a sub-dir of /apps/pub/crx-quickstart?

Here is the snippets

Creating a Statefulset

    volumeMounts:
    - name: publisher
      mountPath: /apps/publisher/crx-quickstart
    env:

volumeClaimTemplates:

  • metadata:
    name: publisher
    spec:
    accessModes: [ “ReadWriteOnce” ]
    resources:
    requests:
    storage: 100Gi

So this /apps/publisher/crx-quickstart will mount inside the POD and all the content should be visible but nothing is coming inside.

It looks correct for me. You mount the empty,100Gi volume to /apps/publisher/crx-quickstart. If you have some files there they are “covered” by this mount.

But it is not happening inside the container when i am going and doing ls -ltr only one directory lost+found is present. even though inside the container it has mounted well

Interesting… it looks like you hit the difference between K8s and docker volumes implementations.

Docker: https://docs.docker.com/storage/volumes/#populate-a-volume-using-a-container

K8s: I’m pretty sure there is no such mechanism