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
我在 kubernetes pod 上运行 kaniko 以构建 docker 映像并推送到 GCR。
当我为 CONTEXT_PATH 使用谷歌云存储时,它工作正常,但我需要使用 Local_directory(意味着使用 pod 的共享卷)作为 CONTEXT_PATH 它会引发错误
"Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile
用法:
I tried with args "--context=/workspace" , "--context=dir://workspace" , it gives the same error