如何在 jenkins 的从节点中选择 docker 代理
how docker agent is selected in slave node in jenkins
在下面的Jenkinsfile中,使用了agent docker
https://www.jenkins.io/doc/book/pipeline/docker/
但是用的是哪个slave,能不能指向我要的VM运行docker?
pipeline {
agent {
docker { image 'node:14-alpine' }
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
类似
agent {
label "dockerserver"
docker { image 'node:14-alpine' }
}
Jenkins 假设任何配置的代理都可以 运行 docker 容器。这记录在这里:https://www.jenkins.io/doc/book/pipeline/docker/#specifying-a-docker-label
可以在系统配置中将标签配置为 select 哪些代理可以 运行 容器:
Pipeline provides a global option in the Manage Jenkins page, and on the Folder level, for specifying which agents (by Label) to use for running Docker-based Pipelines.
将标签附加到应该 运行 docker 容器的代理上。
在下面的Jenkinsfile中,使用了agent docker
https://www.jenkins.io/doc/book/pipeline/docker/
但是用的是哪个slave,能不能指向我要的VM运行docker?
pipeline {
agent {
docker { image 'node:14-alpine' }
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
类似
agent {
label "dockerserver"
docker { image 'node:14-alpine' }
}
Jenkins 假设任何配置的代理都可以 运行 docker 容器。这记录在这里:https://www.jenkins.io/doc/book/pipeline/docker/#specifying-a-docker-label
可以在系统配置中将标签配置为 select 哪些代理可以 运行 容器:
Pipeline provides a global option in the Manage Jenkins page, and on the Folder level, for specifying which agents (by Label) to use for running Docker-based Pipelines.
将标签附加到应该 运行 docker 容器的代理上。