Jenkins is the CI/CD orchestration engine at the heart of this stack. It auto-configures on first boot using Groovy scripts placed inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/infra-neo/CICD/llms.txt
Use this file to discover all available pages before exploring further.
jenkins/init.groovy.d/ — no setup wizard, no manual plugin installation, and no credential entry required. By the time Jenkins is accessible on port 8080, the admin user, essential plugins, Maven tool, SonarQube server connection, and Nexus credentials are all ready to use.
Quick Reference
| Property | Value |
|---|---|
| Web Port | 8080 |
| Agent Port | 50000 |
| Image | jenkins/jenkins:lts |
| Container Name | jenkins |
| Default Credentials | admin / admin |
| Data Volume | jenkins_home |
Auto-Configuration Scripts
Jenkins executes every.groovy file found in /usr/share/jenkins/ref/init.groovy.d/ on first startup, which maps to ./jenkins/init.groovy.d/ in the project directory. The six scripts run in filename order and handle the complete initial configuration.
Creates the
admin account, sets up HudsonPrivateSecurityRealm, and applies FullControlOnceLoggedInAuthorizationStrategy so that authenticated users have full access while anonymous access is disabled.import jenkins.model.*
import hudson.security.*
def instance = Jenkins.getInstance()
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("admin", "admin")
instance.setSecurityRealm(hudsonRealm)
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
strategy.setAllowAnonymousRead(false)
instance.setAuthorizationStrategy(strategy)
instance.save()
println "Admin user created with username: admin, password: admin"
Iterates the plugin list and deploys any plugin not already installed, then signals Jenkins to restart if required.
def plugins = [
"git",
"workflow-aggregator",
"pipeline-maven",
"maven-plugin",
"sonar",
"nexus-artifact-uploader",
"credentials",
"credentials-binding",
"config-file-provider",
"docker-workflow",
"pipeline-utility-steps"
]
sonarqube-token — A StringCredentialsImpl (secret text) holding the SonarQube authentication token, defaulting to admin.nexus-credentials — A UsernamePasswordCredentialsImpl for Nexus, defaulting to admin / admin123.Calls
SonarGlobalConfiguration to register a SonarQube installation named SonarQube pointing to http://sonarqube:9000 and authenticated with the sonarqube-token credential created in the previous step.def sonarInstallation = new SonarInstallation(
"SonarQube",
"http://sonarqube:9000",
"sonarqube-token",
null, null, null, null, null
)
sonarConfig.setInstallations(sonarInstallation)
sonarConfig.save()
Registers Maven 3.9.2 as a managed tool installation named
Maven 3.9.2 so that Jenkinsfile tools { maven 'Maven 3.9.2' } declarations resolve correctly.def mavenInstaller = new Maven.MavenInstaller("3.9.2")
def installSourceProperty = new InstallSourceProperty([mavenInstaller])
def maven = new Maven.MavenInstallation(
"Maven 3.9.2",
null,
[installSourceProperty]
)
mavenDesc.setInstallations(maven)
mavenDesc.save()
Customizing Jenkins
Changing Admin Credentials
Editjenkins/init.groovy.d/01-admin-user.groovy and replace the hardcoded values before first boot. If the stack has already started, bring it down, remove the jenkins_home volume, update the script, and restart.
Adding More Plugins
Extend theplugins list in jenkins/init.groovy.d/02-install-plugins.groovy. The script skips plugins that are already installed, so it is safe to add entries incrementally.
Adding JDK Installations
Create a new filejenkins/init.groovy.d/07-configure-jdk.groovy to register a JDK as a managed tool (note: 06- is already used by 06-configure-appserver-credentials.groovy):
tools { jdk 'JDK 17' } and the pipeline resolves the correct JAVA_HOME automatically.
Docker Socket Access
The Jenkins container runs asroot and mounts the host Docker socket:
docker cp to push WAR files into running WildFly and JBoss containers without needing a Docker-in-Docker sidecar.
Scaling Jenkins
The agent port50000 is exposed so that external Jenkins agents (nodes) can connect via the JNLP protocol. To add an agent:
- In Jenkins, go to Manage Jenkins → Nodes → New Node.
- Select Permanent Agent and configure the node labels (e.g.,
linux,maven,docker). - Start the agent container or process pointing to
http://jenkins:50000. - Use
agent { label 'your-label' }in Jenkinsfiles to route stages to specific agents.
Troubleshooting
Jenkins won't start — container exits immediately or port 8080 is unreachable
Jenkins won't start — container exits immediately or port 8080 is unreachable
- Check whether port 8080 is already bound on the host:
- Inspect container logs:
- If Jenkins is running out of memory, increase the heap in
docker-compose.yml: - As a last resort, remove the volume and start fresh:
Plugins not installing — listed plugins are missing after startup
Plugins not installing — listed plugins are missing after startup
- Wait 2–3 minutes for Jenkins to fully initialize before checking. Plugin installation is asynchronous.
- Review the init script output in the container logs:
- Verify that Jenkins can reach the update center:
- As a fallback, install plugins manually via Manage Jenkins → Manage Plugins → Available.
Setup wizard appears despite configuration
Setup wizard appears despite configuration
The setup wizard means the Ensure there are no typos and that the
JAVA_OPTS flag was not passed correctly. Verify your docker-compose.yml has:-D flag is prefixed correctly. After fixing, bring the stack down and back up:Can't reach SonarQube or Nexus from within a pipeline
Can't reach SonarQube or Nexus from within a pipeline
- Confirm all services are on the same Docker network:
- Test connectivity directly from the Jenkins container:
- SonarQube takes 2–3 minutes to initialize after the container reports healthy. Retry after waiting.
- If the network is missing, recreate it:
