<p>I am unable to upload a file through a deployment YAML in Kubernetes.<br />
The deployment YAML</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  labels:
    app: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: openjdk:14
        ports:
        - containerPort: 8080
        volumeMounts: 
        - name: testing
          mountPath: &quot;/usr/src/myapp/docker.jar&quot;
        workingDir: &quot;/usr/src/myapp&quot;
        command: [&quot;java&quot;]
        args: [&quot;-jar&quot;, &quot;docker.jar&quot;]        
      volumes: 
      - hostPath: 
          path: &quot;C:\\Users\\user\\Desktop\\kubernetes\\docker.jar&quot;
          type: File
        name: testing
</code></pre>
<p>I get the following error:</p>
<pre><code>Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  19s                default-scheduler  Successfully assigned default/test-64fb7fbc75-mhnnj to minikube
  Normal   Pulled     13s (x3 over 15s)  kubelet            Container image &quot;openjdk:14&quot; already present on machine
  Warning  Failed     12s (x3 over 14s)  kubelet            Error: Error response from daemon: invalid mode: /usr/src/myapp/docker.jar
</code></pre>
<p>When I remove the volumeMount it runs with the error unable to access docker.jar.</p>
<pre><code>        volumeMounts: 
        - name: testing
          mountPath: &quot;/usr/src/myapp/docker.jar&quot;
</code></pre>

Yanir
<p>This is a community wiki asnwer. Feel free to expand it.</p>
<p>That is a known issue with Docker on Windows. Right now it is not possible to correctly mount Windows directories as volumes.</p>
<p>You could try some of the workarounds mentioned by @CodeWizard in <a href="https://github.com/kubernetes/kubernetes/issues/59876" rel="nofollow noreferrer">this github thread</a> like <a href="https://github.com/kubernetes/kubernetes/issues/59876#issuecomment-628955935" rel="nofollow noreferrer">here</a> or <a href="https://github.com/kubernetes/kubernetes/issues/59876#issuecomment-390452420" rel="nofollow noreferrer">here</a>.</p>
<p>Also, if you are using VirtualBox, you might want to check <a href="https://stackoverflow.com/a/52887435/11560878">this solution</a>:</p>
<blockquote>
<p>On Windows, you can not directly map Windows directory to your
container. Because your containers are reside inside a VirtualBox VM.
So your docker -v command actually maps the directory between the VM
and the container.</p>
<p>So you have to do it in two steps:</p>
<p>Map a Windows directory to the VM through VirtualBox manager Map a
directory in your container to the directory in your VM You better use
the Kitematic UI to help you. It is much eaiser.</p>
</blockquote>
<p>Alternatively, you can deploy your setup on Linux environment to completely omit those specific kind of issues.</p>
