Unable to download agent.jar

Hi, I recently deployed the Jenkins Docker container (jenkins/jenkins:lts-jdk17) on my Linux server and set up an agent. However, I encountered an error when running the agent.jar with the command provided in the instructions:

java -jar agent.jar -url http://xxx.xxx.xxx.xxx:8080/jenkins/ -secret xxxxxxxxxxxxxxx -name "XXXXXX" -workDir "C:\dev\jenkins"

The error message was: ‘Error: Invalid or corrupt jarfile agent.jar.’

Upon opening agent.jar with a text editor, I discovered it was actually an HTML file indicating an authentication issue:



<meta http-equiv='refresh' content='1;url=/login?from=%2Fjenkins%2FjnlpJars%2Fagent.jar'/>

<script id='redirect' data-redirect-url='/login?from=%2Fjenkins%2FjnlpJars%2Fagent.jar' src='/static/84148f85/scripts/redirect.js'></script>


<body style='background-color:white; color:white;'>

Authentication required





I tried downloading agent.jar from /jenkins/jnlpJars/agent.jar with my browser that logged in to the Jenkins server instead of curl.exe but still no luck:

Any ideas on this? Thanks!

Try https://xxx.xxx.xxx.xxx:8080/jenkins/jnlpJars/jenkins-cli.jar. From what you posted your jenkins base url is not https://xxx.xxx.xxx.xxx:8080/ but https://xxx.xxx.xxx.xxx:8080/jenkins/

If you do have access to the controller UI, under Manage Jenkins, click on Jenkins CLI, and you should see a working link to your jenkins-cli.jar.

In the worst case the jar is not specific to you deployment so you could just download the latest jenkis.war from www.jenkins.io/download, unzip it and get the WEB-INF/lib/cli-xxx.jar file from there, it should work just fine with any recent version of jenkins.