Jenkins Inbound Agent Docker Image
这是一个用于Jenkins代理的镜像,该镜像支持通过TCP或WebSocket协议建立入站连接至Jenkins控制器,旨在实现代理与控制器之间的稳定通信,确保Jenkins任务能够在代理节点上顺利执行,适用于需要灵活配置网络连接方式的Jenkins环境,为分布式构建和部署提供可靠的基础设施支持。
Docker image for inbound Jenkins agents
:exclamation: Warning! This image used to be published as https://hub.docker.com/r/jenkinsci/jnlp-slave/ and https://hub.docker.com/r/jenkins/jnlp-slave/. These images are deprecated, use https://hub.docker.com/r/jenkins/inbound-agent/.
This is an image for https://jenkins.io agents using TCP or WebSockets to establish inbound connection to the Jenkins controller. This agent is powered by the https://github.com/jenkinsci/remoting, which version is being taken from the base https://github.com/jenkinsci/docker-agents/README_agent.md image.
See https://www.jenkins.io/doc/book/using/using-agents/ for more info.
Configuring agents with this container image
Setup the agent on Jenkins
-
Go to your Jenkins dashboard
-
Go to
Manage Jenkinsoption in main menu -
Go to
Nodesitem inSystem Configuration -
Go to
New Nodeoption in side menu -
Fill the Node(agent) name and select the type; (e.g. Name: agent1, Type: Permanent Agent)
-
Now fill the fields like remote root directory, labels, # of executors, etc.
Launch methodisLaunch agent by connecting it to the controller
-
Press the
Savebutton and the agent1 will be registered, but offline for the time being. Click on it. -
You should now see the secret. Use the secret value to pass it to the argument of container, or set to
JENKINS_SECRETas environment variable.
Running this container
To run a Docker container
Note Remember to replace the
<secret>and<agent name>for secret and agent name, which can be you can get(and set) from https://github.com/jenkinsci/docker-agents/blob/3391.va_37fa_a_305d6d-1/README_inbound-agent.md#Setup-the-agent-on-Jenkins. Your agent node should be possible to connect to Jenkins controller with agent port (not Jenkins server's port like 80, 443, 8080), which can be set inManage Jenkins>Security>Agent. Default port is 50000.
Linux agent:
docker run --init jenkins/inbound-agent -url [***] <secret> <agent name>
Note: --init is necessary for correct subprocesses handling (zombie reaping)
Windows agent:
docker run jenkins/inbound-agent:windowsservercore-ltsc2022 -Url [***] -Secret <secret> -Name <agent name>
To run a Docker container with https://github.com/jenkinsci/remoting/blob/master/docs/workDir.md
Linux agent:
docker run --init jenkins/inbound-agent -url [***] -workDir=/home/jenkins/agent <secret> <agent name>
Windows agent:
docker run jenkins/inbound-agent:windowsservercore-ltsc2022 -Url [***] -WorkDir=C:/Jenkins/agent -Secret <secret> -Name <agent name>
Optional environment variables:
JENKINS_JAVA_BIN: Path to Java executable to use instead of the default in PATH or obtained from JAVA_HOMEJENKINS_JAVA_OPTS: Java Options to use for the remoting process, otherwise obtained from JAVA_OPTS, Warning :exclamation: For more information on Windows usage, please see the Windows Jenkins Java Opts https://github.com/jenkinsci/docker-agents/blob/3391.va_37fa_a_305d6d-1/README_inbound-agent.md#windows-jenkins-java-opts.JENKINS_AGENT_FILE: Jenkins agent jar file location,/usr/share/jenkins/agent.jarwill be used if this is not setREMOTING_OPTS: Generic way to pass additional CLI options to agent.jar (see -help)
Deprecated environment variables (prefer setting REMOTING_OPTS)
JENKINS_URL: url for the Jenkins server, can be used as a replacement to-urloption, or to set alternate jenkins URLJENKINS_TUNNEL: (HOST:PORT) connect to this agent host and port instead of Jenkins server, assuming this one do route TCP traffic to Jenkins controller. Useful when when Jenkins runs behind a load ***, reverse proxy, etc.JENKINS_SECRET: (use only if not set as an argument) the secret as shown on the controller after creating the agentJENKINS_AGENT_NAME: (use only if not set as an argument) the name of the agent, it should match the name you specified when creating the agent on the controllerJENKINS_AGENT_WORKDIR: agent work directory, if not set by optional parameter-workDirJENKINS_WEB_SOCKET:trueif the connection should be made via WebSocket rather than TCPJENKINS_DIRECT_CONNECTION: (HOST:PORT) Connect directly to this TCP agent port, skipping the HTTP(S) connection parameter download.JENKINS_INSTANCE_IDENTITY: The base64 encoded InstanceIdentity byte array of the Jenkins controller. When this is set, the agent skips connecting to an HTTP(S) port for connection info.JENKINS_PROTOCOLS: Specify the remoting protocols to attempt whenJENKINS_INSTANCE_IDENTITYis provided.
Example
-
Enter the command above.
-
Check the Jenkins dashboard if the agent is connected well.
Windows Jenkins Java Opts
The processing of the JENKINS_JAVA_OPTS environment variable or -JenkinsJavaOpts command line parameter follow the command parsing semantics of Powershell. This means that if a parameter contains any characters that are part of an expression in Powershell, it will need to be surrounded by quotes. For example:
-XX:+PrintCommandLineFlags --show-version
This would need to be escaped with quotes like this:
"-XX:+PrintCommandLineFlags" --show-version
Or another example: -Dsome.property=some value --show-version
This would need to be escaped like this:
"-Dsome.property='some value'" --show-version
Configuration specifics
Enabled JNLP protocols
As of version 3.40-1 this image only supports the https://github.com/jenkinsci/remoting/blob/master/docs/protocols.md#jnlp4-connect protocol. Earlier, long-unsupported protocols have been removed. As a result, Jenkins versions prior to 2.32 are no longer supported.
Amazon ECS
Make sure your ECS container agent is http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html before running. Older versions do not properly handle the entryPoint parameter. See the http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definitions definition for more information.
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 inbound-agent 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务