Docker plugin: How to create build image still providing JDK8 with Jenkins 2.361.1?

The controller and agent must run java 11. So that means java in the path and/or JAVA_HOME is set to jdk 11. Its recommended against running jobs on your controller itself, as it opens up people to be able to mess with jenkins itself.

Your jobs however can run whatever they want. You’d want the job to have PATH and JAVA_HOME env variables set to whatever jdk you want. I would recommend doing this in the configure node/agent screens, where you can override environmental variables.

But, to extend a docker image you would go

FROM jenkins/jenkins:lts # or other version
USER root
RUN .... whatever commands you want
USER jenkins

push docker image somewhere

1 Like