jenkinsci / jenkinsci/ssh-agent-plugin

[JENKINS-43050] SSH Agent plugin doesn't work well with docker pipelines

Open
#228 8 comments 0 reactions 0 assignees View on GitHub
component:ssh-agent-plugin imported-jira-issue priority:critical resolution:unresolved
Dominant language
Java
Stars
63
Forks
81
Avg merge
5h 36m
Merged PRs (30d)
9

Description

I've tried

dockerImage.inside {

sshagent([...]) {
sh '...'
}
}

and this appears to fail because the ssh-agent gets launched but then the next command

appears to be ssh-agent -k which kills the process before the sh step has a chance to run despite the sh command being inside the sshagent block.

And also

sshagent([...]){

dockerImage.inside {
sh '...'
}
}

fails (I think) for a more predictable reason: the ssh-agent stays running and the env variables get

set correctly inside the container, however the socket is in /tmp on the container server which is not visible to the container (by default).

---
Originally reported by elatt, imported from: SSH Agent plugin doesn't work well with docker pipelines


  • status: Open
  • priority: Critical
  • component(s): ssh-agent-plugin
  • resolution: Unresolved
  • votes: 3
  • watchers: 9
  • imported: 20260604-211335

Raw content of original issue

I've tried



dockerImage.inside {

sshagent([...]) {
sh '...'
}
}


and this appears to fail because the ssh-agent gets launched but then the next command
appears to be ssh-agent -k which kills the process before the sh step has a chance to run despite the sh command being inside the sshagent block.

And also



sshagent([...]){

dockerImage.inside {
sh '...'
}
}


fails (I think) for a more predictable reason: the ssh-agent stays running and the env variables get
set correctly inside the container, however the socket is in /tmp on the container server which is not visible to the container (by default).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.