Install Jenkins with Docker Compose
Dockerhub Jenkins (opens in a new tab)
-
Create docker-compose.yml
docker-compose.ymlversion: '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
- You can map
-
Start docker-compose.yml as background
docker-compose up -d
-
Verify Jenkins container service
docker-compose ps
-
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