[英]how docker agent is selected in slave node in jenkins
in Jenkinsfile below, agent docker
is used https://www.jenkins.io/doc/book/pipeline/docker/在下面的 Jenkinsfile 中,使用
agent docker
docker https://www.jenkins.io/doc/book/pipeline/docker/
But which slave is used, can I point to the VM I want to run docker?但是用的是哪个slave,能不能指向我要运行docker的VM?
pipeline {
agent {
docker { image 'node:14-alpine' }
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
Something like就像是
agent {
label "dockerserver"
docker { image 'node:14-alpine' }
}
Jenkins assumes any configured agent can run docker containers. Jenkins 假设任何配置的代理都可以运行 docker 容器。 This is documented here: https://www.jenkins.io/doc/book/pipeline/docker/#specifying-a-docker-label
这在此处记录: https : //www.jenkins.io/doc/book/pipeline/docker/#specifying-a-docker-label
A label can be configured in the System Configuration to select which agents can run containers:可以在系统配置中配置一个标签来选择哪些代理可以运行容器:
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.
Pipeline 在 Manage Jenkins 页面和文件夹级别提供了一个全局选项,用于指定要使用哪些代理(按标签)来运行基于 Docker 的管道。
Attach the label to the agents which should run docker containers.将标签附加到应该运行 docker 容器的代理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.