Install Jenkins with Docker-Compose

Learn how to install Jenkins with Docker-Compose

karchunt

Kar Chun Tan

Creator

Metadata

Wed Mar 26 2025

1 min read

101 words

Learn how to install Jenkins with Docker Compose

More Information

Create docker-compose.yml

docker-compose.yml
version: '3.8'
services:
  jenkins:
    image: jenkins/jenkins:jdk11
    restart: always
    privileged: true
    user: root
    ports:
      - '8081:8080'
      - '50000:5000'
    container_name: jenkins_jdk11
    volumes:
      - ~/Desktop/self-hosted/jenkins_home:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
  • You can map /var/jenkins_home to any local location you liked

Get the Jenkins admin password

docker exec jenkins_jdk11 cat /var/jenkins_home/secrets/initialAdminPassword

Open your browser

Navigate to localhost:8081, and paste your password.