【发布时间】:2019-08-16 12:20:27
【问题描述】:
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
【问题讨论】:
-
您应该正确地格式化问题,使其可读,看起来整洁且易于理解,还可以提供简要背景等。您可以在提交前使用预览选项。这将帮助您从社区中获得最佳解决方案/答案,并且可能还会获得一些支持!
-
你好,请描述问题,你做了什么,并使用代码格式化,以便更多地关注你的问题。
-
/workspace 目录是否存在于本地服务器上?
-
/workspace 在本地服务器上不存在,它存在于 pod 上。 @error404
标签: docker kubernetes google-cloud-platform kaniko