Kubernetes populate with base image Kubernetes populate with base image kubernetes kubernetes

Kubernetes populate with base image


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: v1kind: Podmetadata:  name: test-pdspec:  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.