Custom Jenkins image based on jenkins/jenkins:lts-jdk21 (latest LTS, JDK 21).
- Base image:
jenkins/jenkins:lts-jdk21(latest LTS) - Setup wizard disabled (
-Djenkins.install.runSetupWizard=false) - Plugins preinstalled from
plugins.txt - Init scripts in
init.groovy.d/(0 executors on the built-in node, workspace cleanup thread disabled)
docker build -t bndynet/jenkins .
Or use the helper script:
./rebuild.sh # build & run, plugins downloaded at build time ./rebuild.sh --predownloaded # slow networks: pre-download plugins first
On slow networks, --predownloaded runs sync-plugins.py first, which downloads all plugins and their dependencies from a China-friendly mirror into plugins/, so the build itself needs no network access for plugins.
All Jenkins data lives in /var/jenkins_home (plugins, jobs, configuration). Make it a persistent volume (recommended):
docker run --name my-jenkins \
-p 8080:8080 -p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
-d \
bndynet/jenkinsTo let Jenkins build Docker images (docker-in-jenkins), also mount the Docker socket:
docker run --name my-jenkins \
-p 8080:8080 -p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-d \
bndynet/jenkinsThe container runs as the
jenkinsuser. To grant access to/var/run/docker.sock, add thejenkinsuser (uid 1000) to the host'sdockergroup instead of running the container with--user root.
docker exec -it my-jenkins bash
- Setup wizard is disabled, so there is no initial admin password —
/var/jenkins_home/secrets/initialAdminPasswordis not generated. - Security is not configured out of the box (anonymous full access). Configure it with the already-installed
configuration-as-code(JCasC) and/ormatrix-authplugins.
If you have enabled security and locked yourself out:
- Stop Jenkins:
docker stop my-jenkins- Open
config.xmlin the Jenkins home volume- Find
<useSecurity>true</useSecurity>and change it to<useSecurity>false</useSecurity>- Start Jenkins:
docker start my-jenkins