2 - How To Restart The Jenkins Service Inside Your Docker Container
2 - How To Restart The Jenkins Service Inside Your Docker Container
For reference:
jenkins@92dc7d76bbc5:~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
jenkins 1 0.0 0.0 2472 1024 ? Ss 06:32 0:00 /usr/bin/tini --
/usr/local/bin/jenkins.sh
jenkins 8 12.7 21.6 4680144 867176 ? Sl 06:32 2:37 java
-Duser.home=/var/jenkins_home -Djenkins.model.Jenkins.slaveAgentPort=50000 -
Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle -jar /usr
jenkins 139 0.0 0.0 4608 3584 pts/0 Ss+ 06:34 0:00 bash
jenkins 225 0.0 0.0 4608 3328 pts/1 Ss 06:46 0:00 bash
jenkins 264 0.0 0.1 8480 4352 pts/1 R+ 06:53 0:00 ps aux
To restart the Jenkins service inside your Docker container, you have a few options:
Since Jenkins is running as a Java process (java -jar ...), you can restart it manually:
kill -9 8
Here, 8 is the PID of the Java process running Jenkins (from your ps aux output). After
killing it, Docker's process manager (tini) should restart it automatically.
If it doesn't restart automatically, you can start it manually inside the container:
/usr/local/bin/jenkins.sh
This will stop and start the container, effectively restarting Jenkins with all changes applied.
This ensures a full reset of the running container while preserving data.