A docker image running on my laptop with docker volume folder myVolume
inside it bounded to a folder on my desktop ( can be any directory on host machine) Desktop-Volume
:
docker run -it -v ~/Desktop/Desktop-Volume:/myVolume ..
There are files and folders inside Desktop-Volume
, when the docker app runs this folder got populated with newly created files which of course after shutting down the docker they still remain in Desktop-Volume
,
Now, i create a Kubernetes cluster on Google Cloud and make PersistentVolumes and run the deployment
, but the container crashes because it depends on those pre-processed Desktop-Volume
in order to initialize , so i need to place those files into PersistentVolumes before running my container on Kubernetes cluster ,but i don't know how .
The pod was something like this
spec:
volumes:
- name: demo
persistentVolumeClaim:
claimName: disk
containers:
- name: myContainer
image: "gcr.io/my-instance/myDocker:latest"
volumeMounts:
- mountPath: "/myVolume"
name: disk
I also tried :
i connect
to cluster shell and from there upload the Desktop-Volume.zip
from my laptop to the shell then unzip and set
hostPath:
path: "/home/<name>/Desktop-Volume"
but the container crashed no such a file or directory
referring to files which reside in myVolume
through Desktop-Volume
- how can i place the content of my pre-processed
Desktop-Volume
files into PersistentVolumes before running container on cluster ? - where is the mount path of the PersistentVolumes so that i can
ls
to there and see my files ?