Docker 기반 Jenkins 설치 방법을 정리하였습니다.
1. 호스트 <-> 컨테이너 퍼머넌트(permanent) 생성
$ mkdir -p /app/jenkins
$ chmod 777 /app/jenkins
2. Jenkins 실행
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -v /app/jenkins:/var/jenkins_home \
-u root -e JAVA_OPTS='-Duser.timezone=Asia/Seoul -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8' \
jenkins/jenkins:lts
3. 웹 브라우저에서 설치 이어가기
http://<ip>:8080 접속하여 설치를 이어갑니다.
3-1. 비밀번호 입력
$ docker exec -it jenkins /bin/bash
$ cat /var/jenkins_home/secrets/initialAdminPassword
3830de413f4d49f7963223507527f02a # 비밀번호
3-2. 플러그인 설치
default로 설치하고, 프로그레스바(progress bar)가 완료될 때까지 기다립니다.
3-3. 어드민 계정 생성
계정명(로그인 ID), 비밀번호, 이름, 이메일 주소를 입력합니다.
3-4. Jenkins URL 설정
4. Jenkins 설치 완료
Jenkins 공식 docker 저장소 이미지를 사용하면, Locale과 Timezone이 대한민국 설정값이 아닙니다.
Dockerfile 을 직접 제작하여, 도커 이미지를 생성하여 사용하시길 추천드립니다.
관련 링크 : www.facebook.com/groups/jenkinskorea/permalink/2095905250505768/
$ cat Dockerfile
... 중략
# Set the locale ko_KR.UTF-8
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# ko_KR.UTF-8 UTF-8/ko_KR.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=ko_KR.UTF-8
ENV LANG ko_KR.UTF-8
RUN locale-gen ko_KR.UTF-8
ENV LANG ko_KR.UTF-8
ENV LANGUAGE ko_KR.UTF-8
ENV LC_ALL ko_KR.UTF-8
# Set TimeZone Seoul
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
... 중략