Docker_Jenkins_Installation_Inside_Container

Docker_Jenkins_Installation_Inside_Container

Docker_Jenkins_Installation_InSide_Container

Inside the container, first, install perquestery ( JAVA )

[root@a5f159e16af7 /]# yum install java-1.8.0-openjdk-devel

Download Jenkins repo for YUM.

[root@a5f159e16af7 /]# curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | tee /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1
[root@a5f159e16af7 /]# cat /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1

Import key (gpg key) for installation.

[root@a5f159e16af7 /]# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

Install Jenkins using YUM.

[root@a5f159e16af7 /]# yum install jenkins
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
jenkins                                                                                                                                                              | 2.9 kB  00:00:00
jenkins/primary_db                                                                                                                                                   |  26 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.150.1-1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                     Arch                                       Version                                           Repository                                   Size
============================================================================================================================================================================================
Installing:
 jenkins                                     noarch                                     2.150.1-1.1                                       jenkins                                      72 M

Transaction Summary
============================================================================================================================================================================================
Install  1 Package

Total download size: 72 M
Installed size: 72 M
Is this ok [y/d/N]: y
Downloading packages:
jenkins-2.150.1-1.1.noarch.rpm                                                                                                                                       |  72 MB  00:00:41
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : jenkins-2.150.1-1.1.noarch                                                                                                                                               1/1
  Verifying  : jenkins-2.150.1-1.1.noarch                                                                                                                                               1/1

Installed:
  jenkins.noarch 0:2.150.1-1.1

Complete!

Now enable and start service.

During this you maybe some issue with service enable/start.

[root@a5f159e16af7 /]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.

[root@a5f159e16af7 /]# systemctl restart jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

[root@a5f159e16af7 /]# /etc/init.d/jenkins start
/etc/init.d/jenkins: line 59: /etc/init.d/functions: No such file or directory

To resolve this issue install "initscripts".

[root@a5f159e16af7 yum.repos.d]# yum install -y initscripts
[root@3b5e4744c969 /]# systemctl start jenkins
[root@3b5e4744c969 /]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on
[root@3b5e4744c969 /]# /sbin/chkconfig jenkins on

Now access Jenkins on default port 8080.

First time you need to set admin password. For that you run below command to see encrypted passowrd.

[root@feenixdv conf]# docker exec -it a5f159e16af7 cat /var/lib/jenkins/secrets/initialAdminPassword

Past output on login windows and set new password for admin. at the end you have login screen.

 

Leave a Reply

Your email address will not be published. Required fields are marked *