Jenkins EC2 On Docker

2344 단어 jenkinsjenkins

구성 방법

Docker, Docker-compose 설치

# docker 설치
$ sudo yum -y install docker
$ sudo systemctl enable docker
$ sudo systemctl start docker
$ sudo chmod 666 /var/run/docker.sock

# docker-compose 설치
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# docker-compose 권한변경
$ sudo chmod +x /usr/local/bin/docker-compose

# docker-compose 심볼릭 링크 설정
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

# docker-compose 버전확인
$ docker-compose -version

docker-compose.yml

version: "3.7"

services:
  jenkins:
    container_name: jenkins
    image: jenkins/jenkins:jdk11
    restart: unless-stopped
    user: root
    ports:
      - 8080:8080
      - 50000:50000
    volumes:
      - /jenkins/data:/root
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
    environment:
      JENKINS_HOME: /root
      TZ: 'Asia/Seoul'

Jenkins 설치 및 설정

# 설치 및 pwd 확인
$ docker-compose up -d
$ docker exec -it jenkins /bin/bash
root@84e7f79eb9f6:/# cat /root/secrets/initialAdminPassword
573844611e2341a1a030de71ff41e431

# jenkins dir 확인
$ ll /jenkins/data
합계 28
-rw-r--r--  1 root root 1598  5월 26 10:11 config.xml
-rw-r--r--  1 root root  156  5월 26 10:10 hudson.model.UpdateCenter.xml
-rw-------  1 root root 1712  5월 26 10:10 identity.key.enc
-rw-r--r--  1 root root  171  5월 26 10:10 jenkins.telemetry.Correlator.xml
drwxr-xr-x  2 root root    6  5월 26 10:10 jobs
drwxr-xr-x  3 root root   19  5월 26 10:10 logs
-rw-r--r--  1 root root  907  5월 26 10:10 nodeMonitors.xml
drwxr-xr-x  2 root root    6  5월 26 10:10 nodes
drwxr-xr-x  2 root root    6  5월 26 10:10 plugins
-rw-r--r--  1 root root   64  5월 26 10:10 secret.key
-rw-r--r--  1 root root    0  5월 26 10:10 secret.key.not-so-secret
drwx------  4 root root  265  5월 26 10:10 secrets
drwxr-xr-x  2 root root   67  5월 26 10:11 updates
drwxr-xr-x  2 root root   24  5월 26 10:10 userContent
drwxr-xr-x  3 root root   57  5월 26 10:10 users
drwxr-xr-x 11 root root 4096  5월 26 10:10 war

Web 접속 및 플러그인 설치

좋은 웹페이지 즐겨찾기