Skip to main content

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

docker compose up -d jenkins

Stop Jenkins

docker compose stop jenkins

This stops the container without deleting its data. Jenkins state lives under JENKINS_HOME on your host, so it survives the container being removed with docker compose rm -f 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):

VariableDefaultWhat it does
JENKINS_HOST_HTTP_PORT8090Host-side port the Jenkins web UI is published on.
JENKINS_HOST_SLAVE_AGENT_PORT50000Host-side port for Jenkins build agents (JNLP).
JENKINS_HOME./jenkins/jenkins_homeHost 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

  1. Start the container, then open http://localhost:8090/.
  2. Sign in with user admin and the auto-generated password:
    docker compose exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
  3. Install the suggested plugins and create your own admin user when prompted.

Admin tasks

Common issues

  • Can't find the initial admin password. It only exists before the setup wizard finishes; run the cat /var/jenkins_home/secrets/initialAdminPassword command above right after first start.
  • Port 8090 already in use. Another local service is bound to it. Change JENKINS_HOST_HTTP_PORT in .env and restart: docker compose up -d 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 running privileged: true.
  • Losing jobs/plugins between rebuilds. Everything Jenkins-specific lives under JENKINS_HOME on your host; don't delete that folder unless you intend to reset Jenkins entirely.

Need a full CI/CD pipeline with its own Git server instead? See GitLab or OneDev. New to Laradock? Start at Getting Started.