Originally published on August 2, 2022 at https://bruno.verachten.fr/2022/08/02/run-your-jenkins-agent-as-a-service/ In this tutorial, we will see how to start a Jenkins agent as a Linux service with systemd . Most of the time, I use Docker for my agents, and I enter the right options on the command line so that they restart automatically. But sometimes, especially when you want to use the famous Dockerfile: true option, you need to start the agent manually with a java command and not with Docker (for various security reasons). And then you need to restart it manually if you have to reboot, or if you forget to use nohup to start it in the background and then close the terminal. Prerequisites Let’s say we’re starting with a fresh Ubuntu 22.04 Linux installation. What do we need to get an agent working? Java, that’s for sure, but also Docker if we want to use Docker for our agents instead of installing everything directly on the machine. Java Nowadays, openjdk 11 is recommended, and openjdk 17 is supported.…