Docker supports named volumes and those volumes are populated with the base image content when mounted.
I need the same for K8s, i.e. I need that a pod will populate a volume with the contents of the base image.
Is that possible with K8s and PVC?
I think you mean that you want to mount a local volume into your Docker image. That is, the local folder is mounted as a volume inside the Docker image.
You can mount a local directory in your Docker container using volume hostPath
http://kubernetes.io/docs/user-guide/volumes/#hostpath
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
containers:
- image: gcr.io/google_containers/test-webserver
name: test-container
volumeMounts:
- mountPath: /test-pd
name: test-volume
volumes:
- name: test-volume
hostPath:
# directory location on host
path: /data
Note that since your container could be deployed on ANY node, that means the hostPath must be available on any node, with the same content, if you want to have reproducible behavior.
In short, this is not meant to mount local data that you interact with, but rather things like libraries, certificates or similar.
As an alternative, you might want to consider using Secrets to mount small amount of data into your Pods.