<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: kaniko
spec:
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:latest
    args:
          - "--context=dir:///workspace"
          - "--dockerfile=/workspace/Dockerfile"
          - "--destination=gcr.io/kubernetsjenkins/jenkinsondoc:latest"
    volumeMounts:
      - name: kaniko-secret
        mountPath: /secret
      - name: context
        mountPath: /workspace
    env:
      - name: GOOGLE_APPLICATION_CREDENTIALS
        value: /secret/kaniko-secret.json
  restartPolicy: Never
  volumes:
    - name: kaniko-secret
      secret:
        secretName: kaniko-secret
    - name: context
      hostPath:
        path: /home/sabadsulla/kanikodir
</code></pre>

<p>I am running kaniko on a kubernetes pod to build a docker image and pushing to the GCR.</p>

<p>When i use google cloud storage for the CONTEXT_PATH it works fine , 
But i need to use the Local_directory(meaning using the shared volumes of the pods) AS the CONTEXT_PATH 
it throws an error </p>

<pre><code>"Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile
</code></pre>

<p>Usage:</p>

<pre><code>I tried with args "--context=/workspace" , "--context=dir://workspace" , it gives the same error
</code></pre>

<p>hi i just solved this problem.</p>
<p>my node name: m1.env.lab.io</p>
<pre><code>my Dockerfile path: /root/kaniko/demo1/Dockerfile

FROM ubuntu
ENTRYPOINT [&quot;/bin/bash&quot;, &quot;-c&quot;, &quot;echo hello&quot;]
</code></pre>
<p>pod.yaml in /root/kaniko/demo1/pod.yaml:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: kaniko
  namespace: kaniko
spec:
  nodeName: m1.env.lab.io
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:latest
    args: [&quot;--verbosity=trace&quot;,
           &quot;--log-format=color&quot;,
           &quot;--dockerfile=Dockerfile&quot;,
           &quot;--context=dir:///workspace/&quot;,
           &quot;--destination=registry.local/cloud2go/kaniko-ubuntu:v0.1&quot;] # no account and password for my registry.
    volumeMounts:
      - name: dockerfile-storage
        mountPath: /workspace/
  restartPolicy: Never
  volumes:
    - name: dockerfile-storage
      hostPath:
         path: /root/kaniko/demo1
</code></pre>
