Jenkins
What is Jenkins?
Jenkins is a widely used open-source automation server for building CI/CD pipelines: running tests, building artifacts, and deploying on every push. Laradock runs it as its own privileged container with access to the Docker socket, so pipeline jobs can build and run other containers.
Start Jenkins
- Laradock CLI
- Docker Compose
./laradock start jenkins
docker compose up -d jenkins
Jenkins state is created on first start under JENKINS_HOME and kept between restarts.
Stop Jenkins
Stopping just pauses the container; your data is safe:
- Laradock CLI
- Docker Compose
./laradock stop jenkins
docker compose stop jenkins
To delete the container entirely (the data on disk is still untouched, it lives under JENKINS_HOME):
- Laradock CLI
- Docker Compose
./laradock remove jenkins
docker compose rm -sf jenkins
Logs
- Laradock CLI
- Docker Compose
./laradock logs jenkins
docker compose logs --tail=100 jenkins
Configuration
All settings live in jenkins/defaults.env and can be overridden by adding the same line to your own .env (your .env always wins):
| Variable | Default | What it does |
|---|---|---|
JENKINS_HOST_HTTP_PORT | 8090 | Host-side port the Jenkins web UI is published on. |
JENKINS_HOST_SLAVE_AGENT_PORT | 50000 | Host-side port for Jenkins build agents (JNLP). |
JENKINS_HOME | ./jenkins/jenkins_home | Host folder mounted to /var/jenkins_home, holds all jobs, plugins, and config. |
The container also runs privileged: true and mounts /var/run/docker.sock, so Jenkins jobs can build and run Docker containers directly.
Initial setup
- Start the container, then open http://localhost:8090/ (or your
JENKINS_HOST_HTTP_PORT). - Sign in with user
adminand the auto-generated password:
- Laradock CLI
- Docker Compose
./laradock exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
docker compose exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
- Install the suggested plugins and create your own admin user when prompted.
Admin tasks
Enter the container as root (needed for some plugin installs or system packages, no friendly CLI shortcut for the root user, use Docker Compose directly):
docker compose exec --user root jenkins bash
For a regular (non-root) shell instead, use the standard enter verb:
- Laradock CLI
- Docker Compose
./laradock enter jenkins
docker compose exec jenkins bash
- Add a user manually at http://localhost:8090/securityRealm/addUser.
- Review or lock down authorization at http://localhost:8090/configureSecurity/.
- Restart Jenkins itself (without restarting the container) at http://localhost:8090/restart.
Change the Jenkins version
The bundled Jenkins version isn't an .env variable, it's baked into the image via build args in jenkins/Dockerfile: JENKINS_VERSION (currently 2.469) and JENKINS_SHA, the matching .war checksum used to verify the download. To bump it:
- Look up the new version's
.warSHA-256 checksum from the Jenkins download site or its release changelog. - Update
ARG JENKINS_VERSIONandARG JENKINS_SHAinjenkins/Dockerfile. - Rebuild:
- Laradock CLI
- Docker Compose
./laradock rebuild jenkins
docker compose build jenkins
- Restart the container:
./laradock restart jenkins. Your jobs, plugins, and config underJENKINS_HOMEcarry over as-is, Jenkins runs its own plugin-compatibility checks on the new version at startup.
Backup and restore
JENKINS_HOME (./jenkins/jenkins_home by default) is a plain host folder, not a named Docker volume, so backing it up is just archiving that folder. Stop the container first so nothing is mid-write:
- Laradock CLI
- Docker Compose
./laradock stop jenkins
docker compose stop jenkins
tar -czf jenkins-backup.tar.gz -C jenkins jenkins_home
./laradock start jenkins
To restore, stop Jenkins, extract the archive back over jenkins/jenkins_home (or point JENKINS_HOME at wherever you extracted it), then start again:
./laradock stop jenkins
rm -rf jenkins/jenkins_home
tar -xzf jenkins-backup.tar.gz -C jenkins
./laradock start jenkins
This is also how you move a Jenkins setup (jobs, plugins, credentials, build history) between machines.
Start completely fresh (wipe all data)
To throw away every job, plugin, and credential and start Jenkins from a clean, empty state (this permanently deletes everything under JENKINS_HOME, back up first if you need anything):
- Laradock CLI
- Docker Compose
./laradock stop jenkins
./laradock remove jenkins
rm -rf "${JENKINS_HOME:-./jenkins/jenkins_home}"
./laradock start jenkins
docker compose stop jenkins
docker compose rm -sf jenkins
rm -rf "${JENKINS_HOME:-./jenkins/jenkins_home}"
docker compose up -d jenkins
Starting again re-runs the full first-boot setup wizard, including a brand-new initialAdminPassword.
Common issues
- Can't find the initial admin password. It only exists before the setup wizard finishes; run the
./laradock exec jenkins cat /var/jenkins_home/secrets/initialAdminPasswordcommand above right after first start. - Port
8090already in use. Another local service is bound to it. ChangeJENKINS_HOST_HTTP_PORTin.envand restart:./laradock restart jenkins. - Jobs that build Docker images fail. Confirm the job actually has access to
/var/run/docker.sock(mounted by default) and that the container is still runningprivileged: true. - Losing jobs/plugins between rebuilds. Everything Jenkins-specific lives under
JENKINS_HOMEon your host; don't delete that folder unless you intend to reset Jenkins entirely. - Build agents can't connect (JNLP). Confirm
JENKINS_HOST_SLAVE_AGENT_PORTis reachable from the agent and matches the port Jenkins itself is configured to use under Manage Jenkins → Configure Global Security.
Need a full CI/CD pipeline with its own Git server instead? See GitLab or OneDev. New to Laradock? Start at Getting Started.