Always take necessary backups. You can go to Manage Jenkins -> Available -> Backup plugin and backup the jobs and other things you want for safety.
- sudo docker container exec -u 0 -it czcjenkins bash
here czcjenkins is my container name. - wget http://updates.jenkins-ci.org/download/war/2.273/jenkins.war
You can chekc the latest jenkins available from this link or just replace the 2.273 with the version you want to upgrade:
https://www.jenkins.io/download/ - mv ./jenkins.war /usr/share/jenkins/
- chown jenkins:jenkins /usr/share/jenkins/jenkins.war
here jenkins is the user, so keep same as it is only. - exit
exit from the czcjenkins container. - sudo docker restart czcjenkins