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
Usage:
I tried with args "--context=/workspace" , "--context=dir://workspace" , it gives the same error
该文件夹看起来像
In host:
/home/sabadsulla/kanikodir/Dockerfile
当它变成PV/PVC时,在pod容器中
/workspace/Dockerfile
那么对于kanino executor
,如果我们将上下文映射到workspace
,dockerfile将与上下文相关的是Dockerfile
, so
--context=/workspace
--dockerfile=Dockerfile
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)