Jenkins与jFrog ArtiFactory推送Docker图像 [英] Jenkins with jFrog Artifactory push Docker images
本文介绍了Jenkins与jFrog ArtiFactory推送Docker图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Jenkins中配置新管道。我已经在Windows Server上购买并安装了jFrog artiFactory PRO,它已启动并在以下位置运行:https://artifactory.mycompany.com
更具体地说这一节:
stage ('Push image to Artifactory') {
steps {
rtDockerPush(
serverId: "ARTIFACTORY_SERVER",
image: ARTIFACTORY_DOCKER_REGISTRY + '/hello-world:latest',
// Host:
// On OSX: "tcp://127.0.0.1:1234"
// On Linux can be omitted or null
host: HOST_NAME,
targetRepo: 'docker-local',
// Attach custom properties to the published artifacts:
properties: 'project-name=docker1;status=stable'
)
}
}
它正在构建和创建docker图像,但当它推送图像时,它无法推送图像并出错。不确定以下内容中应包含的内容:
- ARTIFACTORY_DOKER_REGISTRY
- 主机:HOST_NAME
我已经在artiFactory"docker-local"中创建了一个新的本地存储库。已尝试省略主机并获取
"不支持的操作系统"。
将host放回"host:‘tcp://IP Addresss"或"artifactory.mypanany.com:80/artiFactory"将生成
"不支持的协议方案"
如何配置Jenkins管道以使用jFrog artiFactory?
推荐答案
找到解决方案:
- ARTIFACTORY_DOKER_REGISTRY应为IP/ArtiFactory-Repo-Key/Image:Tag
主机应为docker守护程序(docker for windows为本地主机:2375)
stage('Build image') { // build and tag docker image steps { echo 'Starting to build docker image' script { def dockerfile = 'Dockerfile' def customImage = docker.build('10.20.111.23:8081/docker-virtual/hello-world:latest', "-f ${dockerfile} .") } } } stage ('Push image to Artifactory') { // take that image and push to artifactory steps { rtDockerPush( serverId: "jFrog-ar1", image: "10.20.111.23:8081/docker-virtual/hello-world:latest", host: 'tcp://localhost:2375', targetRepo: 'local-repo', // where to copy to (from docker-virtual) // Attach custom properties to the published artifacts: properties: 'project-name=docker1;status=stable' ) } }
这篇关于Jenkins与jFrog ArtiFactory推送Docker图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文