inbound-agent

Jenkins Inbound Agent Docker Image

这是一个用于Jenkins代理的镜像,该镜像支持通过TCP或WebSocket协议建立入站连接至Jenkins控制器,旨在实现代理与控制器之间的稳定通信,确保Jenkins任务能够在代理节点上顺利执行,适用于需要灵活配置网络连接方式的Jenkins环境,为分布式构建和部署提供可靠的基础设施支持。

146 次收藏下载次数: 0状态:社区镜像维护者:Jenkins 自动化与 CI/CD仓库类型:镜像最近更新:
下载命令
点击查看

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

  1. Go to your Jenkins dashboard

  2. Go to Manage Jenkins option in main menu

  3. Go to Nodes item in System Configuration

  4. Go to New Node option in side menu

  5. Fill the Node(agent) name and select the type; (e.g. Name: agent1, Type: Permanent Agent)

  6. Now fill the fields like remote root directory, labels, # of executors, etc.

  • Launch method is Launch agent by connecting it to the controller
  1. Press the Save button and the agent1 will be registered, but offline for the time being. Click on it.

  2. You should now see the secret. Use the secret value to pass it to the argument of container, or set to JENKINS_SECRET as 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 in Manage 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_HOME
  • JENKINS_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.jar will be used if this is not set
  • REMOTING_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 -url option, or to set alternate jenkins URL
  • JENKINS_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 agent
  • JENKINS_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 controller
  • JENKINS_AGENT_WORKDIR: agent work directory, if not set by optional parameter -workDir
  • JENKINS_WEB_SOCKET: true if the connection should be made via WebSocket rather than TCP
  • JENKINS_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 when JENKINS_INSTANCE_IDENTITY is provided.

Example

  1. Enter the command above.

  2. 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 镜像标签

docker pull docker.xuanyuan.run/jenkins/inbound-agent:<标签>

DockerHub 原生拉取命令

docker pull jenkins/inbound-agent:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告