update jenkins in docker code example

Example: how to upgrade jenkins in docker

# I'll keep it as "jenkins", you can use "jenkins_home" if you wish
mkdir -p $HOME/jenkins
# if you're using other names, replace $HOME/jenkins with your choice
# in case you want to change port, use this
# -e JENKINS_OPTS="--httpPort=80" (remember to change 8080:8080 below to 80:80)
docker container run \
--name jenkins \
-p 8080:8080 -p 50000:50000 \
-v $HOME/jenkins:/var/jenkins_home \
-d \
jenkins

#using host's root with -u 0
docker container exec -u 0 -it jenkins bash
# inside the container, using 2.89.2 as example
wget http://updates.jenkins-ci.org/download/war/2.89.2/jenkins.war
mv ./jenkins.war /usr/share/jenkins
# exit contaienr (inside container)
exit
# restart container (from your server)
docker container restart jenkins
chown jenkins:jenkins /usr/share/jenkins/jenkins.war (updated)
# exit contaienr (inside container)
exit
# restart container (from your server)
docker container restart jenkins


### Second Method

## SourceUrlLink: https://batmat.net/2018/09/07/how-to-run-and-upgrade-jenkins-using-the-official-docker-image/

#How to run Jenkins official Docker image and keep data

docker volume create jenkins-data
docker run --name jenkins-production \
           --detach \
           -p 50000:50000 \
           -p 8080:8080 \
           -v jenkins-data:/var/jenkins_home \
           jenkins/jenkins:2.107.3
# If run for the first time, just run the following to get the admin
# password once it has finished starting
docker exec jenkins-production bash -c 'cat $JENKINS_HOME/secrets/initialAdminPassword'

#How to upgrade your instance to a more recent version

docker stop jenkins-production
docker rm jenkins-production # just temporarily docker rename it instead if that makes you worried
docker run --name jenkins-production \
           --detach \
           -p 50000:50000 \
           -p 8080:8080 \
           -v jenkins-data:/var/jenkins_home \
           jenkins/jenkins:2.121.3