Docker Community Forums

Share and learn in the Docker community.

Mounting a hostPath volume to Windows host from Kubernetes

(Cditcher) #1

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?


(Chanon81) #2

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: