My Docker container running in a minikube
pod has configured a directory mounted from the host's non-empty /home/my_username/useful/dir
. kubectl
shows what I expect:
$ kubectl get --namespace=my_namespace pods/my-pod -o json | jq '.spec.volumes[3]'
{
"hostPath": {
"path": "/hosthome/my_username/useful/dir",
"type": "Directory"
},
"name": "useful_dir"
}
$ kubectl get --namespace=my_namespace pods/my-pod -o json | jq '.spec.containers[].volumeMounts[3]'
{
"mountPath": "/dir/in/container",
"name": "useful_dir",
"readOnly": true
}
But in the pod, the mountpoint is empty:
$ kubectl exec --stdin --tty --namespace my_namespace my-pod -- ls /dir/in/container
total 0
I looked at the pod's mountpoint with kubectl exec --stdin --tty --namespace my_namespace my-pod -- findmnt /dir/in/container
, and see overlay[/hosthome/my_username/useful/dir]
. From this, I conclude that Docker has mounted the directory from the host as expected.
I check the mountpoint directly from a pod's container (as root to make sure there is no permission restriction in the way):
$ docker exec -it -u root minikube /bin/bash
root@minikube:/# docker exec -it -u root <container_id> ls /dir/in/container
root@minikube:/#
It does not have any content which is present in the host.
What should I look for to investigate?
Issue solved in comments, the driver was running dockerd inside a container itself so it didn't have a global filesystem view. Solved via minikube mount
.