How to update jenkins in docker container
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
This is very bad advice. See https://community.jenkins.io/t/just-update-to-2-303-1-docker-container-still-says-i-need-java-11/461/2 for a detailed description that explains why this is very bad advidce