gpt4 book ai didi

docker - Jenkins:在Windows上构建并推送Docker镜像

转载 作者:行者123 更新时间:2023-12-02 19:21:47 26 4
gpt4 key购买 nike

如何使用Jenkins构建和推送docker镜像?

我具有在安装了Windows docker的Windows 10 Jenkins从属服务器上执行的以下管道。

node("windows_10_pro_n_vs2017") {

checkout scm

def app

stage('Build image') {
/* This builds the actual image; synonymous to
* docker build on the command line */

app = docker.build("simmarn/emma2html:win -f docker-windows/Dockerfile .")
}

stage('Push image') {
/* Finally, we'll push the image with two tags:
* First, the incremental build number from Jenkins
* Second, the 'win' tag.
* Pushing multiple tags is cheap, as all the layers are reused. */
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
app.push("${env.BUILD_NUMBER}")
app.push("win")
}
}

}

但是,如果没有任何有用的信息,构建将失败:
        Started by user ...
23:32:31 Connecting to https://api.github.com using .../****** (GitHub Access Token)
Obtained Jenkinsfile from ...
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on win1 in C:\jenkins\workspace\emma2html_master
[Pipeline] {
[Pipeline] checkout
using credential github
....
[Pipeline] stage
[Pipeline] { (Build image)
[Pipeline] sh
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline

我猜docker.build和docker.withRegistry是针对Linux docker的。 Windows docker有适应性吗?

我在Blue Ocean上收到以下错误:

无法运行程序“nohup”(在目录“C:\ jenkins \ workspace \ emma2html_master”中):CreateProcess error = 2,系统找不到指定的文件

/马丁

最佳答案

抱歉,我只需要更新docker-pipeline插件即可使其正常工作。

关于docker - Jenkins:在Windows上构建并推送Docker镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59111708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com