<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>the folder looks like</p>

<p>In host:</p>

<pre><code>/home/sabadsulla/kanikodir/Dockerfile
</code></pre>

<p>When it turns to PV/PVC, in pod container</p>

<pre><code>/workspace/Dockerfile
</code></pre>

<p>Then for <code>kanino executor</code>, if we map the context to <code>workspace</code>, the dockerfile will be related to context is <code>Dockerfile</code>, so </p>

<pre><code>--context=/workspace
--dockerfile=Dockerfile
</code></pre>
