[x] I have tried with the latest version of Docker Desktop
[x] I have tried disabling enabled experimental features
[ ] I have uploaded Diagnostics
Diagnostics ID:
Expected behavior
Volume mounting with hostPath should work
Actual behavior
Volume mounting with hostPath does not work - a directory exists in the pod container, but the contents is always empty.
Same steps work on Docker Desktop Mac
Information
Attempting to kubectl create -f test-pod.yaml with hostPath volume mounting ignores the contents of the host directory and the mounted directory is always empty
The home directory is shared in the Filesharing tab
Steps to reproduce the behavior
Assuming a docker-desktop kubernetes context and given the following pod config yaml, and a directory on the host machine at the defined location below (e.g /home/user/workspace/test) which contains a file helloworld.txt
apiVersion: v1
kind: Pod
metadata:
name: test-pod
namespace: app
spec:
containers:
- command: ["/bin/bash"]
name: hello-world-container
image: ubuntu:22.04
imagePullPolicy: IfNotPresent
stdin: true
tty: true
ports:
- containerPort: 8000
# Mount the volume into the pod
# Vagrant by default mounts the directory with the vagrant file under /vagrant
# we have the Vagrantfile in the root of yoti-backend
volumeMounts:
- mountPath: /test
name: test # must match the name of the volume, above
volumes:
- name: test
hostPath:
path: /home/user/workspace/test/
type: DirectoryOrCreate
running kubectl create -f test-pod.yaml successfully deploys the pod, but when "exec ing" into the pod, the expected test directory is always empty
Expected behavior
Volume mounting with hostPath should work
Actual behavior
Volume mounting with hostPath does not work - a directory exists in the pod container, but the contents is always empty.
Same steps work on Docker Desktop Mac
Information
Attempting to
kubectl create -f test-pod.yaml
with hostPath volume mounting ignores the contents of the host directory and the mounted directory is always emptyThe home directory is shared in the Filesharing tab
Steps to reproduce the behavior
Assuming a docker-desktop kubernetes context and given the following pod config yaml, and a directory on the host machine at the defined location below (e.g
/home/user/workspace/test
) which contains a file helloworld.txtrunning
kubectl create -f test-pod.yaml
successfully deploys the pod, but when "exec ing" into the pod, the expected test directory is always emptyPerhaps a VM issue with path mapping?