How to mount local windows folder to K8S container

Running Docker Desktop 4.34.2 with Kubernetes v1.30.2 enabled under WIndows 11.

I’m struggling to specify the correct path for a local folder on Windows (c:\foo) to be accessible/mounted to a container managed by K8S. From a WSL prompt the folder is /mnt/c/foo
My .yml file contains

 volumeMounts:
      - name: testfoo
          mountPath: /testfoo
      volumes:
      - name: testfoo
        hostPath:
          path: "/run/desktop/mnt/c/foo"

When I exec into the started container, I can see a testfoo folder but it’s empty (and not my local foo folder - which has content/files).

Should I be able to mount a local windows folder in this way ? If so, what’s the correct path to use, please ?

Answering my own question: the correct path is

"/run/desktop/mnt/host/c/foo"
1 Like

Thank you for sharing the solutions. Seems there are not many users that want mount Windows folder in their pods. At least I never had the idea to do so …

I am surprised the path is not just /mnt/c/foo, which would be the path in a WSL distro.