Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Install docker

Install docker-compose

Table of Contents

...

필수 설치

Java 11 설치

참고: Java11 설치 - Rhel 7,8

 

Nginx 설치

Jenkins를 설치 후 도메인으로 접근하기 위해서는 Web서버 필요

참고: Nginx 설치

Docker 설치

Docker Compose 설치

Jenkins Root 폴더 생성

mkdir -p /app/jenkins

...

Jenkins 도커 설치

Docker Compose로 설치

docker-compose-jenkins.yml 파일 생성

vi docker-compose-jenkins.yml

설정 정보 입력

image: 젠킨스 도커 버전

  • 젠킨스 도커 버전 확인: https://

...

...

...

...

Make directory

...

user: jenkins 실행할 유저 설정

port: 젠킨스 실행 포트:리눅스 포트

volumes: 젠킨스 설치경로 등 관련 파일 리눅스 물리 볼륨에 동기화

Mkdir docker-compose-jenkins.yml

Expand
titledocker-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

...

Docker compose로 jenkins container 생성 및 실행

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

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

...

titlejenkins.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_send_timeout 300;

proxy_read_timeout 300;

send_timeout 300;

}

...

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

}

}

...

Jenkins Docker에 설치 확인

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

...