本文主要是介绍kaniko试用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
kaniko介绍
官网:https://github.com/GoogleContainerTools/kaniko
参考:http://dockone.io:82/article/4933
与Jenkins对比:https://yq.aliyun.com/ask/494251/?order=vote_num&p=1
在K8S中运行
apiVersion: v1
kind: Secret
metadata:name: kaniko-secret
type: kubernetes.io/basic-auth
stringData:username: [destination对应镜像仓库账号]password: [destination对应镜像仓库密码]---
apiVersion: v1
kind: Pod
metadata:name: kaniko
spec:nodeSelector:kubernetes.io/hostname: prod-l27-4-23containers:- name: kanikoimage: registry.cn-hangzhou.aliyuncs.com/shenshouer/tektoncd-executor:latestargs:- --dockerfile=/root/kaniko-test/context/Dockerfile- --context=/root/kaniko-test/context- --tarPath=/root/kaniko-test/context/context.tar- --destination=registry.cn-hangzhou.aliyuncs.com/shenshouer/ayena:testvolumeMounts:- name: kaniko-secretmountPath: /secret- name: context-datamountPath: /root/kaniko-test/contextenv:- name: GOOGLE_APPLICATION_CREDENTIALSvalue: /secret/kaniko-secret.jsonrestartPolicy: Nevervolumes:- name: context-datahostPath:path: /root/kaniko-test/contexttype: Directory- name: kaniko-secretsecret:secretName: kaniko-secret
在Docker中运行
docker rm -f kaniko
docker run --name kaniko \-v $HOME/.docker/:/kaniko/.docker \-v `pwd`:/workspace \registry.cn-hangzhou.aliyuncs.com/shenshouer/tektoncd-executor:latest \--dockerfile /workspace/Dockerfile \--destination registry.cn-hangzhou.aliyuncs.com/shenshouer/ayena:test \--context dir:///workspace/
注意:认证信息需要挂载-v $HOME/.docker/:/kaniko/.docker
这篇关于kaniko试用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!