dockerでJenkins環境を構築

概要

いろいろ試すのにJenkins環境が欲しいのでDockerで構築してみる。
後片付けも楽ですし。

Let's try

まずはJenkins用のコンテナを作る

$ docker run -t -i -d --name jenkins  -p 8080:8080 centos:centos6 /bin/bash
d9afa41b2e4d4cf124e4e8a37cd78d5034730736fbccb17c6571e9faa13654b8
$ docker attach jenkins

Javaをインストールする

$ yum install wget java-1.7.0-openjdk

次にJenkinsをインストールする。

// wgetでJenkinsをダウンロード
# wget http://pkg.jenkins-ci.org/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm
--2015-01-28 16:41:08--  http://pkg.jenkins-ci.org/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm
Resolving pkg.jenkins-ci.org... 199.193.196.24
Connecting to pkg.jenkins-ci.org|199.193.196.24|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirrors.jenkins-ci.org/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm [following]
--2015-01-28 16:41:08--  http://mirrors.jenkins-ci.org/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm
Resolving mirrors.jenkins-ci.org... 199.193.196.24
Connecting to mirrors.jenkins-ci.org|199.193.196.24|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ftp.tsukuba.wide.ad.jp/software/jenkins/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm [following]
--2015-01-28 16:41:09--  http://ftp.tsukuba.wide.ad.jp/software/jenkins/redhat-stable/jenkins-1.580.3-1.1.noarch.rpm
Resolving ftp.tsukuba.wide.ad.jp... 203.178.132.80, 2001:200:0:7c06::9393
Connecting to ftp.tsukuba.wide.ad.jp|203.178.132.80|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 62031675 (59M)
Saving to: “jenkins-1.580.3-1.1.noarch.rpm”

100%[========================================================================>] 62,031,675  3.86M/s   in 24s     

2015-01-28 16:41:33 (2.50 MB/s) - “jenkins-1.580.3-1.1.noarch.rpm” saved [62031675/62031675]

[root@d9afa41b2e4d /]# rpm install jenkins-1.580.3-1.1.noarch.rpm
RPM version 4.8.0
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

// rpmでJenkinsをインストール
# rpm -Uvh jenkins-1.580.3-1.1.noarch.rpm 
warning: jenkins-1.580.3-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY
Preparing...                ########################################### [100%]
   1:jenkins                ########################################### [100%]

あとは、起動させるだけ。

# service jenkins start
Starting Jenkins                                           [  OK  ]

アクセスするとJenkinsがちゃんと立ち上がってます。

f:id:rkobayas:20150201022359p:plain