Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Install docker

Install docker-compose

https://docs.docker.com/compose/install/

Make directory

/app/jenkins

Mkdir docker-compose-jenkins.yml

 docker-compose-jenkins.yml

version: '3.7'
services:
jenkins:
image: jenkins/jenkins:2.263.4-jdk11
privileged: true
user: root
ports:
- 8080:8080
- 50000:50000
container_name: jenkins
volumes:
- /app/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker

Run command

docker-compose -f docker-compose-jenkins.yml up -d

Create nginx config file like jenkins.conf on /etc/nginx/conf.d

 jenkins.conf

server {

listen 80;

listen 443;

server_name  jenkins.justten.io;

charset utf-8;

rewrite_log on;

client_max_body_size 50M;

location / {

proxy_pass http://127.0.0.1:8080;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-Proto http;

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-Server $host;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


proxy_connect_timeout 300;

proxy_send_timeout 300;

proxy_read_timeout 300;

send_timeout 300;

}


if ($http_x_forwarded_proto = "http") {

return    301 <https://$server_name$request_uri;>

}

}

Check jenkins

docker ps


Accessing the Jenkins Docker container

docker container exec -it jenkins bash

Accessing the Jenkins console log through Docker logs

docker container logs jenkins 


To Unlocking Jenkins

Find init password

Go To inside docker

docker container exec -it jenkins bash

 

Write

vi /var/jenkins_home/secrets/initialAdminPassword

 

Open Jenkins

type initial password

  • No labels