I installed Jenkins LTS running on Docker a while ago, and it seems to be stuck on version 2.60.3
See my post on stackoverflow for details.
It was suggested to copy the Dockerfile and run something like
docker build --build-arg 2.89.1 -t custom-jenkins .
Is that really the official process? Why does the Dockerfile still reference 2.60.3?
I failed to do this too. I tried setting the JENKINS_VERSION=2.89.1 environment variable before compiling my dockerfile which uses FROM jenkins/jenkins:lts but this will not trigger the version update. So how can I use the parent docker-file with FROM and still get a rebuild when I update the version?
I solved the problem by building the image with
docker build --build-arg JENKINS_VERSION=2.89.1 --build-arg JENKINS_SHA=f9f363959042fce1615ada81ae812e08d79075218c398ed28e68e1302c4b272f -t jenkins-image-2.89.1 .
and then using in my docker-file
FROM jenkins-image-2.89.1
The docker image is built with
sha=$(curl -q -fsSL "https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/${version}/jenkins-war-${version}.war.sha256" )
docker build --file "Dockerfile" \
--build-arg "JENKINS_VERSION=$version" \
--build-arg "JENKINS_SHA=$sha" .
But you don't need to rebuild, just use docker build --pull
@carlossg I am trying to build my own custom image that derives from this ( as in FROM jenkins/jenkins) and I have noticed that when I build my image I get a warning.
Command ran
docker build --file "Dockerfile" --build-arg "JENKINS_VERSION=$jenkins_version" --build-arg "JENKINS_SHA=$sha" .
Warning
[Warning] One or more build-args [JENKINS_VERSION JENKINS_SHA] were not consumed
Does this mean that I cannot set the version in a custom image?
I follow this guide:
https://medium.com/@jimkang/how-to-start-a-new-jenkins-container-and-update-jenkins-with-docker-cf628aa495e9
@mpccolorado that guide is a nice contribution, but IMO should not be followed.
1) it uses a bind-mount when it should use a volume and
2) it's basically showing how to update a Docker image, when one should just switch the used image.
3) it's quite convoluted compared to the standard "Docker way"
I was answering here, but finally wrote a blog entry about it as this question comes a bit too often. I have commented on numerous issues here to recommend people stop using bind mounts, but well :).
Here you are: https://batmat.net/2018/09/07/how-to-run-and-upgrade-jenkins-using-the-official-docker-image/ Hope this helps
@batmat Can you reupload this procedure?
Most helpful comment
@mpccolorado that guide is a nice contribution, but IMO should not be followed.
1) it uses a bind-mount when it should use a volume and
2) it's basically showing how to update a Docker image, when one should just switch the used image.
3) it's quite convoluted compared to the standard "Docker way"
I was answering here, but finally wrote a blog entry about it as this question comes a bit too often. I have commented on numerous issues here to recommend people stop using bind mounts, but well :).
Here you are: https://batmat.net/2018/09/07/how-to-run-and-upgrade-jenkins-using-the-official-docker-image/ Hope this helps