{"id":13442977,"url":"https://github.com/jenkinsci/docker-ssh-agent","last_synced_at":"2025-05-16T01:07:42.300Z","repository":{"id":37839197,"uuid":"41673255","full_name":"jenkinsci/docker-ssh-agent","owner":"jenkinsci","description":"Docker image for Jenkins agents connected over SSH","archived":false,"fork":false,"pushed_at":"2025-05-12T06:24:15.000Z","size":3153,"stargazers_count":197,"open_issues_count":4,"forks_count":177,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-12T07:28:24.958Z","etag":null,"topics":["docker-image","jenkins-agent","ssh"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/repository/docker/jenkins/ssh-agent","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"community_bridge":"jenkins","custom":["https://jenkins.io/donate/#why-donate"]}},"created_at":"2015-08-31T12:07:04.000Z","updated_at":"2025-05-12T06:17:24.000Z","dependencies_parsed_at":"2023-09-25T05:25:56.786Z","dependency_job_id":"e3606d15-7d8b-41d6-8f58-e5fa6c89a751","html_url":"https://github.com/jenkinsci/docker-ssh-agent","commit_stats":{"total_commits":252,"total_committers":29,"mean_commits":8.689655172413794,"dds":0.7142857142857143,"last_synced_commit":"88861a3484c973352a015087833dc3b1531d1c0c"},"previous_names":[],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fdocker-ssh-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fdocker-ssh-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fdocker-ssh-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fdocker-ssh-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/docker-ssh-agent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","jenkins-agent","ssh"],"created_at":"2024-07-31T03:01:54.152Z","updated_at":"2025-05-16T01:07:37.280Z","avatar_url":"https://github.com/jenkinsci.png","language":"PowerShell","funding_links":["https://funding.communitybridge.org/projects/jenkins","https://jenkins.io/donate/#why-donate"],"categories":["Dockerfile","PowerShell"],"sub_categories":[],"readme":"# Docker image for Jenkins agents connected over SSH\n\n[![Join the chat at https://gitter.im/jenkinsci/docker](https://badges.gitter.im/jenkinsci/docker.svg)](https://gitter.im/jenkinsci/docker?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![GitHub stars](https://img.shields.io/github/stars/jenkinsci/docker-ssh-agent?label=GitHub%20stars)](https://github.com/jenkinsci/docker-ssh-agent)\n[![Docker Pulls](https://img.shields.io/docker/pulls/jenkins/ssh-agent.svg)](https://hub.docker.com/r/jenkins/ssh-agent/)\n[![GitHub release](https://img.shields.io/github/release/jenkinsci/docker-ssh-agent.svg?label=changelog)](https://github.com/jenkinsci/docker-ssh-agent/releases)\n\nA [Jenkins](https://jenkins.io) agent image which allows using SSH to establish the connection.\nIt can be used together with the [SSH Build Agents plugin](https://plugins.jenkins.io/ssh-slaves) or other similar plugins.\n\nSee [Jenkins Distributed builds](https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds) for more info.\n\n## Running\n\n### Running with the SSH Build Agents plugin\n\nTo run a Docker container\n\n```bash\ndocker run -d --rm --name=agent --publish 2200:22 -e \"JENKINS_AGENT_SSH_PUBKEY=\u003cpublic_key\u003e\" jenkins/ssh-agent\n```\n\n - `-d`: To start a container in detached mode, use the `-d` option. Containers started in detached mode exit when the root process used to run the container exits, unless you also specify the --rm option.\n - `--rm`: If you use -d with --rm, the container is removed when it exits or when the daemon exits, whichever happens first.\n - `--name`: Assigns a name to the container. If you do not specify a name, Docker generates a random name.\n - `--publish 2200:22`: Publishes the host port 2200 to the agent container port 22 (SSH) to allow connection from the host with `ssh jenkins@localhost -p 2200`\n\nPlease note none of these options are mandatory, they are just examples.\n\nYou will then be able to connect this agent using the [SSH Build Agents plugin](https://plugins.jenkins.io/ssh-slaves) as \"jenkins\" with the matching private key.\n\nWhen using the Linux image, you have to set the value of the `Remote root directory` to `/home/jenkins/agent` in the agent configuration UI.\n\n![Remote root directory with a Linux agent](docs/ssh-plugin-remote-root-directory-linux.png \"Remote root directory with a Linux agent\")\n\nWhen using the Windows image, you have to set the value of the `Remote root directory` to `C:/Users/jenkins/Work` in the agent configuration UI.\n\n![Remote root directory with a Windows agent](docs/ssh-plugin-remote-root-directory-windows.png \"Remote root directory with a Windows agent\")\n\nIf you intend to use another directory than `/home/jenkins/agent` under Linux or `C:/Users/jenkins/Work` under Windows, don't forget to add it as a data volume.\n\n```bash\ndocker run -v docker-volume-for-jenkins-ssh-agent:/home/jenkins/agent:rw jenkins/ssh-agent \"\u003cpublic key\u003e\"\n```\n\n### How to use this image with Docker Plugin\n\nTo use this image with [Docker Plugin](https://plugins.jenkins.io/docker-plugin), you need to pass the public SSH key using environment variable `JENKINS_AGENT_SSH_PUBKEY` and not as a startup argument.\n\nIn _Environment_ field of the Docker Template (advanced section), just add:\n\n    JENKINS_AGENT_SSH_PUBKEY=\u003cYOUR PUBLIC SSH KEY HERE\u003e\n\nDon't put quotes around the public key.\n\nPlease note that you have to set the value of the `Remote File System Root` to `/home/jenkins/agent` in the Docker Agent Template configuration UI.\n\n![Remote File System Root](docs/docker-plugin-remote-filesystem-root.png \"Remote File System Root directory\")\n\nIf you intend to use another directory than `/home/jenkins/agent`, don't forget to add it as a data volume.\n\n![Docker Volumes mounts](docs/docker-plugin-volumes.png \"Docker Volumes mounts\")\n\nYou should be all set.\n\n## Extending the image\nShould you need to extend the image, you could use something along those lines:\n\n```Dockerfile\nFROM jenkins/ssh-agent:debian-jdk17 as ssh-agent\n# [...]\nCOPY --chown=jenkins mykey \"${JENKINS_AGENT_HOME}\"/.ssh/mykey\n# [...]\n```\n\n## Configurations\n\nThe image has several supported configurations, which can be accessed via the following tags:\n\n`${IMAGE_VERSION}` can be found on the [releases](https://github.com/jenkinsci/docker-ssh-agent/releases) page.\n\n* `latest`, `latest-jdk11`, `jdk11`, `latest-bookworm-jdk11`, `bookworm-jdk11`, `latest-debian-jdk11`, `debian-jdk11`, `${IMAGE_VERSION}`, `${IMAGE_VERSION}-jdk11`, ([Dockerfile](debian/Dockerfile))\n* `latest-jdk17`, `jdk17`, `latest-bookworm-jdk17`, `bookworm-jdk17`, `latest-debian-jdk17`, `debian-jdk17`, `${IMAGE_VERSION}-jdk17`, ([Dockerfile](debian/Dockerfile))\n* `nanoserver-1809`, `nanoserver-ltsc2019`, `nanoserver-1809-jdk11`, `nanoserver-ltsc2019-jdk11`, `${IMAGE_VERSION}-nanoserver-1809`, `${IMAGE_VERSION}-nanoserver-ltsc2019`, `${IMAGE_VERSION}-nanoserver-1809-jdk11`, `${IMAGE_VERSION}-nanoserver-ltsc2019-jdk11` ([Dockerfile](windows/nanoserver-ltsc2019/Dockerfile))\n* `windowsservercore-1809`, `windowsservercore-ltsc2019`, `windowsservercore-1809-jdk11`, `windowsservercore-ltsc2019-jdk11`, `${IMAGE_VERSION}-windowsservercore-1809`, `${IMAGE_VERSION}-windowsservercore-ltsc2019`, `${IMAGE_VERSION}-windowsservercore-1809-jdk11`, `${IMAGE_VERSION}-windowsservercore-ltsc2019-jdk11` ([Dockerfile](windows/windowsservercore-ltsc2019/Dockerfile))\n\n## Building instructions\n\n### Pre-requisites\n\nShould you want to build this image on your machine (before submitting a pull request for example), please have a look at the pre-requisites:\n\n* A GNU/Linux machine with [Docker](https://docs.docker.com/engine/install/), a macOS machine with [Docker Desktop](https://docs.docker.com/desktop/install/mac-install/), or a Windows machine with [Docker for Windows](https://docs.docker.com/docker-for-windows/) installed\n* Docker BuildX plugin [installed](https://github.com/docker/buildx#installing) on older versions of Docker (from `19.03`). Docker Buildx is included in recent versions of Docker Desktop for Windows, macOS, and Linux. Docker Linux packages also include Docker Buildx when installed using the DEB or RPM packages.\n* [GNU Make](https://www.gnu.org/software/make/) [installed](https://command-not-found.com/make)\n* jq [installed](https://command-not-found.com/jq)\n* yq [installed](https://github.com/mikefarah/yq) (for Windows)\n* [GNU Bash](https://www.gnu.org/software/bash/) [installed](https://command-not-found.com/bash)\n* git [installed](https://command-not-found.com/git)\n* curl [installed](https://command-not-found.com/curl)\n\n### Building\n\n#### Target images\n\nIf you want to see the target images that will be built, you can issue the following command:\n\n```bash\nmake list\nalpine_jdk11\nalpine_jdk17\ndebian_jdk11\ndebian_jdk17\n```\n\n#### Building a specific image\n\nIf you want to build a specific image, you can issue the following command:\n\n```bash\nmake build-\u003cOS\u003e_\u003cJDK_VERSION\u003e\n```\n\nThat would give for JDK 17 on Alpine Linux:\n\n```bash\nmake build-alpine_jdk17\n```\n\n#### Building images supported by your current architecture\n\nThen, you can build the images supported by your current architecture by running:\n\n```bash\nmake build\n```\n\n#### Testing all images\n\nIf you want to test these images, you can run:\n\n```bash\nmake test\n```\n#### Testing a specific image\n\nIf you want to test a specific image, you can run:\n\n```bash\nmake test-\u003cOS\u003e_\u003cJDK_VERSION\u003e\n```\n\nThat would give for JDK 17 on Alpine Linux:\n\n```bash\nmake test-alpine_jdk17\n```\n\n#### Building all images\n\nYou can build all images (even those unsupported by your current architecture) by running:\n\n```bash\nmake every-build\n```\n\n#### Other `make` targets\n\n`show` gives us a detailed view of the images that will be built, with the tags, platforms, and Dockerfiles.\n\n```bash\nmake show\n{\n  \"group\": {\n    \"default\": {\n      \"targets\": [\n        \"alpine_jdk17\",\n        \"alpine_jdk11\",\n        \"debian_jdk11\",\n        \"debian_jdk17\",\n      ]\n    }\n  },\n  \"target\": {\n    \"alpine_jdk11\": {\n      \"context\": \".\",\n      \"dockerfile\": \"alpine/Dockerfile\",\n      \"tags\": [\n        \"docker.io/jenkins/ssh-agent:alpine-jdk11\",\n        \"docker.io/jenkins/ssh-agent:latest-alpine-jdk11\"\n      ],\n      \"platforms\": [\n        \"linux/amd64\"\n      ],\n      \"output\": [\n        \"type=docker\"\n      ]\n    },\n    [...]\n```\n\n`bats` is a dependency target. It will update the [`bats` submodule](https://github.com/bats-core/bats-core) and run the tests.\n\n```bash\nmake bats\nmake: 'bats' is up to date.\n```\n\n`publish` allows the publication of all images targeted by 'linux' to a registry.\n\n`docker-init` is dedicated to Jenkins infrastructure for initializing docker and isn't required in other contexts.\n\n### Building and testing on Windows\n\n#### Building all images\n\nRun `.\\build.ps1` to launch the build of the images corresponding to the \"windows\" target of docker-bake.hcl.\n\nInternally, the first time you'll run this script and if there is no build-windows.yaml file in your repository, it will use a combination of `docker buildx bake` and `yq` to generate a  build-windows.yaml docker compose file containing all Windows image definitions from docker-bake.hcl. Then it will run `docker compose` on this file to build these images.\n\nYou can modify this docker compose file as you want, then rerun `.\\build.ps1`.\nIt won't regenerate the docker compose file from docker-bake.hcl unless you add the `-OverwriteDockerComposeFile` build.ps1 parameter:  `.\\build.ps1 -OverwriteDockerComposeFile`.\n\nNote: you can generate this docker compose file from docker-bake.hcl yourself with the following command (require `docker buildx` and `yq`):\n\n```console\n# - Use docker buildx bake to output image definitions from the \"windows\" bake target\n# - Convert with yq to the format expected by docker compose\n# - Store the result in the docker compose file\n\n$ docker buildx bake --progress=plain --file=docker-bake.hcl windows --print `\n    | yq --prettyPrint '.target[] | del(.output) | {(. | key): {\\\"image\\\": .tags[0], \\\"build\\\": .}}' | yq '{\\\"services\\\": .}' `\n    | Out-File -FilePath build-windows.yaml\n```\n\nNote that you don't need build.ps1 to build (or to publish) your images from this docker compose file, you can use `docker compose --file=build-windows.yaml build`.\n\n#### Testing all images\n\nRun `.\\build.ps1 test` if you also want to run the tests harness suit.\n\nRun `.\\build.ps1 test -TestsDebug 'debug'` to also get commands \u0026 stderr of tests, displayed on top of them.\nYou can set it to `'verbose'` to also get stdout of every test command.\n\nNote that instead of passing `-TestsDebug` parameter to build.ps1, you can set the  $env:TESTS_DEBUG environment variable to the desired value.\n\nAlso note that contrary to the Linux part, you have to build the images before testing them.\n\n#### Dry run\n\nAdd the `-DryRun` parameter to print out any build, publish or tests commands instead of executing them: `.\\build.ps1 test -DryRun`\n\n#### Building and testing a specific image\n\nYou can build (and test) only one image type by setting `-ImageType` to a combination of Windows flavors (\"nanoserver\" \u0026 \"windowsservercore\") and Windows versions (\"1809\", \"ltsc2019\", \"ltsc2022\").\n\nEx: `.\\build.ps1 -ImageType 'nanoserver-ltsc2019'`\n\nWarning: trying to build `windowsservercore-1809` will fail as there is no corresponding image from Microsoft.\n\n## Changelog\n\nSee [GitHub Releases](https://github.com/jenkinsci/docker-ssh-agent/releases/latest).\nNote that the changelogs and release tags were introduced in Dec 2019, and there are no entries for previous releases.\nPlease consult with the commit history if needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fdocker-ssh-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fdocker-ssh-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fdocker-ssh-agent/lists"}