jenkinsci / docker

Docker official jenkins repo
https://hub.docker.com/r/jenkins/jenkins
MIT License
6.65k stars 4.52k forks source link

Djenkins.install.runSetupWizard=false is not working as expected #1866

Closed githubofkrishnadhas closed 5 months ago

githubofkrishnadhas commented 5 months ago

Jenkins and plugins versions report

Environment ``` Jenkins: 2.414.3 OS: Linux - 6.5.0-1019-azure Java: 11.0.23 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.3.1-1.0 authentication-tokens:1.53.v1c90fd9191a_b_ azure-ad:476.vd1c42682ea_6a_ azure-credentials:312.v0f3973cd1e59 azure-sdk:157.v855da_0b_eb_dc2 blueocean:1.27.11 blueocean-bitbucket-pipeline:1.27.11 blueocean-commons:1.27.11 blueocean-config:1.27.11 blueocean-core-js:1.27.11 blueocean-dashboard:1.27.11 blueocean-display-url:2.4.2 blueocean-events:1.27.11 blueocean-git-pipeline:1.27.11 blueocean-github-pipeline:1.27.11 blueocean-i18n:1.27.11 blueocean-jwt:1.27.11 blueocean-personalization:1.27.11 blueocean-pipeline-api-impl:1.27.11 blueocean-pipeline-editor:1.27.11 blueocean-pipeline-scm-api:1.27.11 blueocean-rest:1.27.11 blueocean-rest-impl:1.27.11 blueocean-web:1.27.11 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1128.v717130d4f816 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloud-stats:336.v788e4055508b_ cloudbees-bitbucket-branch-source:883.v041fa_695e9c2 cloudbees-folder:6.858.v898218f3609d commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-108.v2c41b_8b_2b_269 configuration-as-code:1775.v810dc950b_514 credentials:1319.v7eb_51b_3a_c97b_ credentials-binding:677.vdc9d38cb_254d display-url-api:2.204.vf6fddd8a_8b_e9 docker-commons:439.va_3cb_0a_6a_fb_29 docker-java-api:3.3.4-86.v39b_a_5ede342c docker-plugin:1.5 docker-workflow:572.v950f58993843 durable-task:555.v6802fe0f0b_82 echarts-api:5.4.0-7 favorite:2.208.v91d65b_7792a_c font-awesome-api:6.5.1-2 git:5.2.1 git-client:4.7.0 github:1.38.0 github-api:1.318-461.v7a_c09c9fa_d63 github-branch-source:1787.v8b_8cd49a_f8f1 gson-api:2.10.1-15.v0d99f670e0a_7 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 htmlpublisher:1.33 instance-identity:185.v303dc7c645f9 ionicons-api:70.v2959a_b_74e3cf jackson2-api:2.17.0-379.v02de8ec9f64c jakarta-activation-api:2.1.3-1 jakarta-mail-api:2.1.3-1 javax-activation-api:1.2.0-6 jaxb:2.3.9-1 jenkins-design-language:1.27.11 jjwt-api:0.11.5-112.ve82dfb_224b_a_d joda-time-api:2.12.7-29.v5a_b_e3a_82269a_ jquery3-api:3.7.1-1 json-api:20240303-41.v94e11e6de726 json-path-api:2.9.0-33.v2527142f2e1d junit:1265.v65b_14fa_f12f0 kubernetes:4054.v2da_8e2794884 kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2 kubernetes-credentials:0.11 mailer:470.vc91f60c5d8e2 matrix-auth:3.2.2 matrix-project:822.824.v14451b_c0fd42 metrics:4.2.21-449.v6960d7c54c69 mina-sshd-api-common:2.12.1-101.v85b_e08b_780dd mina-sshd-api-core:2.12.1-101.v85b_e08b_780dd okhttp-api:4.11.0-172.vda_da_1feeb_c6e pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-graph-analysis:216.vfd8b_ece330ca_ pipeline-groovy-lib:704.vc58b_8890a_384 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:119.vdfdc43fc3b_9a_ pipeline-model-api:2.2150.v4cfd8916915c pipeline-model-definition:2.2150.v4cfd8916915c pipeline-model-extensions:2.2150.v4cfd8916915c pipeline-rest-api:2.34 pipeline-stage-step:312.v8cd10304c27a_ pipeline-stage-tags-metadata:2.2150.v4cfd8916915c pipeline-stage-view:2.34 plain-credentials:179.vc5cb_98f6db_38 plugin-util-api:3.8.0 prism-api:1.29.0-8 pubsub-light:1.18 rebuild:332.va_1ee476d8f6d resource-disposer:0.23 role-strategy:689.v731678c3e0eb_ scm-api:676.v886669a_199a_a_ script-security:1335.vf07d9ce377a_e snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.17.2 sse-gateway:1.26 ssh-credentials:337.v395d2403ccd4 ssh-slaves:2.948.vb_8050d697fec structs:337.v1b_04ea_4df7c8 token-macro:400.v35420b_922dcb_ trilead-api:2.142.v748523a_76693 variant:60.v7290fc0eb_b_cd workflow-api:1291.v51fd2a_625da_7 workflow-basic-steps:1058.vcb_fc1e3a_21a_9 workflow-cps:3894.vd0f0248b_a_fc4 workflow-durable-task-step:1331.vc8c2fed35334 workflow-job:1385.vb_58b_86ea_fff1 workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:427.v4ca_6512e7df1 workflow-step-api:657.v03b_e8115821b_ workflow-support:896.v175a_a_9c5b_78f ws-cleanup:0.45 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

I am setting up a jenkins docker image. base image used is oraclelinux 9. jenkins versions and plugin details are shared above

Reproduction steps

This is my repo https://github.com/devwithkrishna/create-jenkins-docker-image. so when i run the docker compose file to create docker image and run as a container, even though i pass the JAVA_OPTS="-Djenkins.install.runSetupWizard=false" i am still getting the plugin installtion page and start jenkins screen.

docker compose command: docker-compose --env-file .env up -d

image

post clicking the cross button this getting started appears

image

Expected Results

I was expecting entire admin user set up, initial admin password step, plugin installation step all these as skipped by using JAVA_OPTS="-Djenkins.install.runSetupWizard=false"

Actual Results

as mentioned in picture, only the initial admin password step is skipped. still plugins is there

Anything else?

what can i do to fix this? or is this the expected scenario?

Are you interested in contributing a fix?

I am not good with java. so i wont be able to provide a solution

lemeurherve commented 5 months ago

Tested with this repo docker image with success, no setup wizard:

docker run -it -p 8080:8080 -e JAVA_OPTS="-Djenkins.install.runSetupWizard=false" jenkins/jenkins

Taking a look at your repository Dockerfile, it appears you're not using https://hub.docker.com/r/jenkins/jenkins/ as base.

I'd suggest trying to use it as base, or ask about your own image issue on https://community.jenkins.io as it's unrelated to this repository and the official Jenkins controller image.

githubofkrishnadhas commented 5 months ago

I am using Oracle Linux as base image as that is my requirement. I know if I use the image suggested by you it will work.

However JAVA_OPTS Awith other option should ideally work everywhere irrespective of the base image.

Don't you agree?

lemeurherve commented 5 months ago

However JAVA_OPTS Awith other option should ideally work everywhere irrespective of the base image.

Don't you agree?

I would argue that it would be a Jenkins Core issue to be reported on https://issues.jenkins.io, not here in the repository dedicated to the Jenkins controller docker image.

I don't know why you're getting the setup wizard with your docker compose, but your docker image seems fine. I've just tested building your image from your Dockerfile then ran the same command from my previous comment on it, the setup wizard was correctly skipped.

githubofkrishnadhas commented 5 months ago

Initial set up wizard to copy paste the initial admin key is skipped perfectly. But it shows an optional window to install plugins as shared in the beginning of thread.

dduportal commented 5 months ago

What is your entrypoint in the container (or inherited image)? The environment variable is only used to pass options to the java command line used to run Jenkins as you can see in the official image entrypoint: https://github.com/jenkinsci/docker/blob/edfeba7c0d7a709c411ff412a79643aaab0f7a95/jenkins.sh#L49.

Please update your custom image accordingly to map to the official image or even better: use the official image as it provides a JDK tested with Jenkins. If you cannot use the official image, can you explain the reasons and blockers?