Docker Community Forums

Share and learn in the Docker community.

Mounting a hostPath volume to Windows host from Kubernetes

I am running Docker (edge version 1.37) with Kubernetes on my local machine to do some development work. If I am just running docker from the command line on my machine i can spin up a container and mount a volume like so:

docker run -v D:\myhost\mydirectory:/myvolume ... 

However, when creating a deployment to Kubernetes, is it possible to mount the same volume to a container running inside a pod? For example, the following deployment fails to mount because i assume kubernetes is itself running inside a container and does not recognize my system path D:\myhost\path

apiVersion: extensions/v1beta1
kind: Deployment
  name: myDeployment
      - name: mymount
        mountPath: /etc/mymount
    - name: mymount
        path: D:\myhost\path
        type: Directory

Is there some magic I can do to achieve this?


1 Like

I would also very much would like to know this.

I wanted to use Kubernetes to setup a development environment, but not being able to mount Windows folders into the containers would make it unusable.

Also I’m running into this issue:

Someone could help me find documentation on this subject since the little I have been able to find is for Linux, and I would like to be able to try it in my work environment. Thank you.
By the way, I have the same problem but I think it must be the semantics that I am using in the manifesto. Some example would come more than good. Thank you!!

I’m also finding it hard to locate what the solution is to this. Does anyone have the instructions to get it working?

Hey, did you get to the bottom of this i’m also trying to do the same thing. I’ve also tried specifying the path based on the WSL path of e.g.
path: /mnt/c/directory/etc

but no joy. Anyone get this working?