title: How to mimic Docker ability to pre-populate a volume from a container directory with Kubernetes
body: <p>I am migrating my previous deployment made with docker-compose to Kubernetes.
  In my previous deployment, some containers do have <strong>some data made at build time</strong> in some paths and these <strong>paths are mounted in persistent volumes</strong>.
  Therefore, as the <a href="https://docs.docker.com/storage/volumes/#populate-a-volume-using-a-container" rel="nofollow noreferrer">Docker volume documentation states</a>,<em>the persistent volume (not a bind mount) will be pre-populated with the container directory content</em>.</p>
  
  <p>I'd like to achieve this behavior with Kubernetes and its persistent volumes, How can I do ? Do I need to add some kind of logic using scripts in order to copy my container's files to the mounted path when data is not present the first time the container starts ?</p>
  
  <p>Possibly related question: <a href="https://stackoverflow.com/questions/58128591/kubernetes-mount-volume-on-existing-directory-with-files-inside-the-container">Kubernetes mount volume on existing directory with files inside the container</a></p>