我正在尝试使用一个叫Kaniko的Jenkins共享库来构建容器。Jenkins是运行在Kubernetes集群上的CloudBees核心。
我更喜欢使用pod模板来构建容器,但如果有必要的话,我可以回到专用的VM (但我的客户会不高兴)。
The problem:从简单的Jenkinsfile
管道运行Kaniko很好,但是当我尝试从shared-library
运行它时会出错。
我的共享库的片段:
docker.image('kaniko').inside('-u root --privileged') {
sh '''#!/busybox/sh
/kaniko/executor --context `pwd` --destination docker.artifactory.company.com/docker-local/hello-kaniko:latest
'''
}
我得到的错误(剪短):
.
.
.
Building: default
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh
+ docker inspect -f . kaniko
/home/jenkins/workspace/cloud-services@tmp/durable-28d8debd/script.sh: line 1: docker: not found
[Pipeline] sh
+ docker pull kaniko
/home/jenkins/workspace/cloud-services@tmp/durable-dc065568/script.sh: line 1: docker: not found
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
有没有其他人能让Kaniko从库伯内特斯的詹金斯的共享图书馆里跑出来?
发布于 2019-07-11 12:06:00
我在kaniko容器中也遇到了类似的问题,我要做的就是为环境添加路径:
withEnv(['PATH+EXTRA=/busybox:/kaniko']) {
sh '''#!/busybox/sh
/kaniko/executor (....)
}
https://stackoverflow.com/questions/56078521
复制相似问题