Skip to content

Instantly share code, notes, and snippets.

@prongbang
Forked from ricardo-dlc/README.md
Last active September 7, 2024 03:59
Show Gist options
  • Save prongbang/690e68b4895be0e81a3589d7c7221c12 to your computer and use it in GitHub Desktop.
Save prongbang/690e68b4895be0e81a3589d7c7221c12 to your computer and use it in GitHub Desktop.
Update Jenkins Inside a Docker Container

First identify your image.

$ docker ps --format "{{.ID}}: {{.Image}} {{.Names}}"
3d2fb2ab2ca5: jenkins-docker jenkins-docker_1

Then login into the image as root.

$ docker container exec -u 0 -it jenkins-docker_1 /bin/bash

Run command in stopped container

$ docker run -u 0 -it jenkins/jenkins:lts-jdk17 bash

Now you are inside the container, download the jenkins.war file from the official site like.

# wget wget http://updates.jenkins-ci.org/download/war/2.176.1/jenkins.war

Replace the version with the one that fits to you.

The next step is to move that file and replace the oldest one.

# mv ./jenkins.war /usr/share/jenkins/

Then change permissions.

# chown jenkins:jenkins /usr/share/jenkins/jenkins.war

The last step is to logout from the container and restart it.

$ docker restart jenkins-docker_1

You can verify that update was successful by access to you Jenkins url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment