0% found this document useful (0 votes)
150 views2 pages

2 - How To Restart The Jenkins Service Inside Your Docker Container

To restart the Jenkins service in a Docker container, you can either kill the Jenkins Java process and let Docker's process manager restart it, or you can restart the entire Docker container using 'docker restart jenkins-master'. Alternatively, if the restart command doesn't work, you can manually stop and start the container with 'docker stop jenkins-master' followed by 'docker start jenkins-master'. This ensures that all changes, including plugin uninstalls, are applied effectively.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views2 pages

2 - How To Restart The Jenkins Service Inside Your Docker Container

To restart the Jenkins service in a Docker container, you can either kill the Jenkins Java process and let Docker's process manager restart it, or you can restart the entire Docker container using 'docker restart jenkins-master'. Alternatively, if the restart command doesn't work, you can manually stop and start the container with 'docker stop jenkins-master' followed by 'docker start jenkins-master'. This ensures that all changes, including plugin uninstalls, are applied effectively.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

I'm running Jenkins in docker container using "jenkins/jenkins" image.

how can I restart the jenkins


service from docker after uninstalling plugins etc?

For reference:

jenkins@92dc7d76bbc5:~$ cat /etc/os-release


PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

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:

1️⃣Restart the Jenkins Process Inside the Container

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

2️⃣Restart the Entire Docker Container (Recommended)

The simplest way is to restart the whole container:

docker restart jenkins-master

This will stop and start the container, effectively restarting Jenkins with all changes applied.

3️⃣Stop & Start the Jenkins Container Manually


If docker restart doesn't work as expected, you can manually stop and start the container:

docker stop jenkins-master


docker start jenkins-master

This ensures a full reset of the running container while preserving data.

You might also like