Unable to run jenkins build inside a docker agent using SSH connection method

You’ve not provided enough details so that others can duplicate your configuration. The details you’ve provided are using an unmaintained container image. Assisting without enough information is a frustrating experience for those who try to assist. Please provide clear steps of the exact changes you made so that others can duplicate your configuration exactly.

I took the following steps to confirm that I can use the jenkins/ssh-agent:5.22.0-alpine3.19-jdk21 container image with Jenkins 2.426.2 running with Java 21.

  1. I added an ED 25519 SSH private key to my Jenkins 2.426.2 controller running with Java 21 and then on another machine, called “testing-b”, I started the ssh-agent container image listening on port 2200 and using the ssh public key like this:
docker run -d --rm --name=agent \
    --publish 2200:22 \
    -e "JENKINS_AGENT_SSH_PUBKEY=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHoGWb80kSBywPtvWbgeng7itaw7Tu6d/nXaxIKTQ05Z" \
    jenkins/ssh-agent:5.22.0-alpine3.19-jdk21
  1. I added the ssh private key associated with that ED25519 public key to my Jenkins 2.426.2 controller as a credential for the user “jenkins”
  2. I configured a Jenkins agent on my Jenkins 2.426.2 controller with the agent home directory “/home/jenkins/agent”, the hostname “testing-b”, and the port 2200
  3. I clicked “Launch agent” and confirmed that the agent connected correctly

I did not use the docker plugin to control that agent because I did not want the added complexity of configuring a network accessible docker daemon. Using a static agent is enough to show that the authentication works and the agent is connected.