Post

Ubuntu에 Docker 이미지로 Jenkins 설치

1. Jenkins Docker 이미지 pull

1
$ sudo docker pull jenkins/jenkins:lts

2. Docker 사용

1) 이미지 실행

1
$ sudo docker run --name jenkins -p 8080:8080 -p 50000:50000 --restart=on-failure -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

3. Docker Compose 사용

1) docker-compose.yml 생성

1
2
3
4
5
6
7
8
9
10
11
12
13
version: '3.9'
services:
  jenkins:
    image: jenkins/jenkins:lts
    privileged: true
    container_name: jenkins
    user: root
    ports:
      - "8080:8080"
      - "50000:50000"
    volumes:
      - ./jenkins:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock

2) docker-compose 실행

1
$ sudo docker-compose up -d

4. 접속

1
http://127.0.0.1:8080

5. 초기 Administrator password 확인

1) jenkins 컨테이너 접속

1
$ sudo docker exec -it jenkins /bin/bash

2) Administrator password 확인

1
root@12a53e47f651:/# cat /var/jenkins_home/secrets/initialAdminPassword

[출처 및 참고]

This post is licensed under CC BY 4.0 by the author.