Monthly Archives: February 2018

15. DevOps: How to setup jenkins 2.9 on Ubuntu-16.04 with jdk8 with a trouble shoot video guidance

jenkins

In continuation of blog related to Jenkins installation on Win10 url :https://vskumar.blog/2017/11/25/1-devops-jenkins2-9-installation-with-java-9-on-windows-10/

In this blog I would like to demonstrate on Jenkins 2.9 installation using Ubuntu 16.04 OS with JDK8. I used Ubuntu 16.04 VM.  You can use your standalone Ubuntu machine also.

At the end  a video link is given for this entire exercise…. with a job run…

[Note: If you are a student and in need of  Ubuntu 16.04 VM copy, I can share it. You need to send a request through linkedin with your identity please. At the bottom of this blog you can get my details.]

If you want to install Jenkins you need to have JDK in the Ubuntu machine.

You need to install JDK8 as 1st instance for Jenkins setup:

How to install JDK8?:

Step 1:-
Download JDK 8 tar.gz file from official website

Step 2:-
Extract contents using tar command

$tar -xzvf filename.tar.gz

Step 3 :-
Move Extracted file to /usr/local/java Directory
=====CLI Screen output ===>
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ cd /usr/local
vskumar@ubuntu:/usr/local$ ls
bin etc games include lib man sbin share src
vskumar@ubuntu:/usr/local$ mkdir java
mkdir: cannot create directory ‘java’: Permission denied
vskumar@ubuntu:/usr/local$ sudo mkdir java
[sudo] password for vskumar:
vskumar@ubuntu:/usr/local$ ls
bin etc games include java lib man sbin share src
vskumar@ubuntu:/usr/local$
vskumar@ubuntu:/usr/local$ cd java
vskumar@ubuntu:/usr/local/java$

vskumar@ubuntu:~$
vskumar@ubuntu:~$ ls
data-volume1 Downloads jdk-9.0.4_linux-x64_bin.tar.gz Public
Desktop examples.desktop Music Templates
Documents flask-test Pictures Videos
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$

vskumar@ubuntu:~/Downloads$ ls
firefox-57.0.tar.bz2 jdk1.8.0_161 jdk-8u161-linux-x64.tar.gz

vskumar@ubuntu:~/Downloads$ sudo mv jdk1.8.0_161 /usr/local/java
[sudo] password for vskumar:
vskumar@ubuntu:~/Downloads$ ls
firefox-57.0.tar.bz2 jdk-8u161-linux-x64.tar.gz
vskumar@ubuntu:~/Downloads$
vskumar@ubuntu:/usr/local/java$ pwd
/usr/local/java
vskumar@ubuntu:/usr/local/java$ ls -l
total 4
drwxr-xr-x 8 vskumar vskumar 4096 Dec 19 16:24 jdk1.8.0_161
vskumar@ubuntu:/usr/local/java$

==jdk8 unzipped files are moved into /usr/local/java ===>

Step 4: – Now,
Update Alternatives

$sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_161/bin/java” 1

$sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_161/bin/javac” 1

$sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_161/bin/javaws” 1

=== Output===>

vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ pwd
/usr/local/java/jdk1.8.0_161
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_161/bin/java” 1
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_161/bin/javac” 1
update-alternatives: using /usr/local/java/jdk1.8.0_161/bin/javac to provide /usr/bin/javac (javac) in auto mode
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_161/bin/javaws” 1
update-alternatives: using /usr/local/java/jdk1.8.0_161/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
==============>

Step 5 :-
Check Java version
$ java -version

======>
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ java -version
java version “1.8.0_161”
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
====We have done JDKsetup ===>

Now, You can see “How to install Jenkins on Ubuntu 16.04?”:

For details Visit: https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Ubuntu

Step1:
First, we need to add the jenkins repository key to the ubuntu system.

$ sudo wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –

When the key is added, the system will return ‘OK’

Step2:
Now, we need to append the Debian package repository
address to the server’s sources.list:

$echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list

The screen ouput for the above steps:
=== Screen output of Step1 and Step2====>
vskumar@ubuntu:~$ sudo wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –
OK
vskumar@ubuntu:~$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list
deb https://pkg.jenkins.io/debian-stable binary/
vskumar@ubuntu:~$ sudo apt-get update
===============>

When both of the above steps are executed, we’ll run update so that apt-get will use
the new repository:

Step3:
$sudo apt-get update

==== You will see the below screen output ===>
vskumar@ubuntu:~$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list
deb https://pkg.jenkins.io/debian-stable binary/
vskumar@ubuntu:~$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu xenial InRelease
Ign:2 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:3 https://pkg.jenkins.io/debian-stable binary/ Release
Reading package lists… Done
vskumar@ubuntu:~$
========================>

========>
vskumar@ubuntu:~$ sudo find . / jenkins | grep ‘jenkins’
find: ‘/run/user/1000/gvfs’: Permission denied
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Packages
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Release.gpg
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Release
find: ‘jenkins’: No such file or directory
vskumar@ubuntu:~$
==============>

Step4:
Include JAVA_HOME = /usr/local/java/jdk1.8.0_161
in .shrc file.

Now, we will install Jenkins and its dependencies:

$sudo apt-get install jenkins
Whenyou run this command your might get the below error:
=== Dependecy issues ======>
vskumar@ubuntu:~$ sudo apt-get install jenkins
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
jenkins : Depends: daemon but it is not installable
Depends: default-jre-headless (>= 2:1.8) or
java8-runtime-headless
E: Unable to correct problems, you have held broken packages.
vskumar@ubuntu:~$
======================>

To resolve this issued, Under Ubuntu Software tab, enable all the repositories.
The system updates all the packages/libs.

Visit for details:
https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa

After doing the repositories updates as mentioned above, I have re-executed the install command:

==== Screen Output of Jenkins installation ====
vskumar@ubuntu:~$ sudo apt-get install jenkins
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
ca-certificates-java daemon default-jre-headless java-common
openjdk-8-jre-headless
Suggested packages:
default-jre openjdk-8-jre-jamvm fonts-dejavu-extra fonts-ipafont-gothic
fonts-ipafont-mincho ttf-wqy-microhei | ttf-wqy-zenhei fonts-indic
The following NEW packages will be installed:
ca-certificates-java daemon default-jre-headless java-common jenkins
openjdk-8-jre-headless
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 101 MB of archives.
After this operation, 174 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 java-common all 0.56ubuntu2 [7,742 B]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 default-jre-headless amd64 2:1.8-56ubuntu2 [4,380 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 ca-certificates-java all 20160321 [12.9 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 openjdk-8-jre-headless amd64 8u77-b03-3ubuntu3 [26.9 MB]
Get:5 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.89.4 [73.7 MB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 daemon amd64 0.6.4-1 [98.2 kB]
Fetched 101 MB in 2min 9s (775 kB/s)
Selecting previously unselected package java-common.
(Reading database … 217445 files and directories currently installed.)
Preparing to unpack …/java-common_0.56ubuntu2_all.deb …
Unpacking java-common (0.56ubuntu2) …
Selecting previously unselected package default-jre-headless.
Preparing to unpack …/default-jre-headless_2%3a1.8-56ubuntu2_amd64.deb …
Unpacking default-jre-headless (2:1.8-56ubuntu2) …
Selecting previously unselected package ca-certificates-java.
Preparing to unpack …/ca-certificates-java_20160321_all.deb …
Unpacking ca-certificates-java (20160321) …
Selecting previously unselected package openjdk-8-jre-headless:amd64.
Preparing to unpack …/openjdk-8-jre-headless_8u77-b03-3ubuntu3_amd64.deb …
Unpacking openjdk-8-jre-headless:amd64 (8u77-b03-3ubuntu3) …
Selecting previously unselected package daemon.
Preparing to unpack …/daemon_0.6.4-1_amd64.deb …
Unpacking daemon (0.6.4-1) …
Selecting previously unselected package jenkins.
Preparing to unpack …/jenkins_2.89.4_all.deb …
Unpacking jenkins (2.89.4) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for ca-certificates (20170717~16.04.1) …
Updating certificates in /etc/ssl/certs…
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d…
done.
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Setting up java-common (0.56ubuntu2) …
Setting up daemon (0.6.4-1) …
Setting up openjdk-8-jre-headless:amd64 (8u77-b03-3ubuntu3) …
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Setting up ca-certificates-java (20160321) …
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem
Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem
Adding debian:Deutsche_Telekom_Root_CA_2.pem
Adding debian:Izenpe.com.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:EC-ACC.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:ACCVRAIZ1.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:GeoTrust_Universal_CA_2.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:Security_Communication_EV_RootCA1.pem
Adding debian:AddTrust_Low-Value_Services_Root.pem
Adding debian:Amazon_Root_CA_1.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:OpenTrust_Root_CA_G1.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:Camerfirma_Chambers_of_Commerce_Root.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:Certigna.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:Swisscom_Root_EV_CA_2.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:CNNIC_ROOT.pem
Adding debian:AddTrust_External_Root.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:GeoTrust_Primary_Certification_Authority.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:ACEDICOM_Root.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:Taiwan_GRCA.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:ssl-cert-snakeoil.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:GeoTrust_Global_CA.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:UTN_USERFirst_Hardware_Root_CA.pem
Adding debian:DST_ACES_CA_X6.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:Certinomis_-_Autorité_Racine.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:TURKTRUST_Certificate_Services_Provider_Root_2007.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:Certum_Trusted_Network_CA_2.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:LuxTrust_Global_Root_2.pem
Adding debian:AddTrust_Public_Services_Root.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:Amazon_Root_CA_4.pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Saglayicisi_H5.pem
Adding debian:ISRG_Root_X1.pem
Adding debian:AC_RAIZ_FNMT-RCM.pem
Adding debian:Swisscom_Root_CA_2.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:Comodo_Trusted_Services_root.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:NetLock_Arany_=Class_Gold=_Fotanúsítvány.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
Adding debian:Secure_Global_CA.pem
Adding debian:Certinomis_-_Root_CA.pem
Adding debian:AddTrust_Qualified_Certificates_Root.pem
Adding debian:Certplus_Root_CA_G2.pem
Adding debian:Amazon_Root_CA_2.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:GeoTrust_Global_CA_2.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:SZAFIR_ROOT_CA2.pem
Adding debian:PSCProcert.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:Swisscom_Root_CA_1.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem
Adding debian:Certplus_Class_2_Primary_CA.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:GeoTrust_Universal_CA.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:China_Internet_Network_Information_Center_EV_Certificates_Root.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:OpenTrust_Root_CA_G2.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
Adding debian:Amazon_Root_CA_3.pem
Adding debian:Certum_Root_CA.pem
Adding debian:EE_Certification_Centre_Root_CA.pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:SecureTrust_CA.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:Certplus_Root_CA_G1.pem
Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem
Adding debian:TÜBITAK_UEKAE_Kök_Sertifika_Hizmet_Saglayicisi_-_Sürüm_3.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:OpenTrust_Root_CA_G3.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:CA_Disig_Root_R1.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:Comodo_Secure_Services_root.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:Camerfirma_Global_Chambersign_Root.pem
Adding debian:SecureSign_RootCA11.pem
done.
Setting up default-jre-headless (2:1.8-56ubuntu2) …
Setting up jenkins (2.89.4) …
Processing triggers for ca-certificates (20170717~16.04.1) …
Updating certificates in /etc/ssl/certs…
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d…

done.
done.
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
vskumar@ubuntu:~$
== End of Jenkins intallation ========>

==== Updates ====>

vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 https://download.docker.com/linux/ubuntu xenial InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:5 https://pkg.jenkins.io/debian-stable binary/ Release
Reading package lists… Done
vskumar@ubuntu:~$
=============>

Step5:

How to install apache2?:
If we need to use jenkins apache2 is required.
Now let us install apache2

=== Output for apache installation ===>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo apt install apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,532 kB of archives.
After this operation, 6,350 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8,720 B]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-bin amd64 2.4.18-2ubuntu3 [918 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-utils amd64 2.4.18-2ubuntu3 [81.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-data all 2.4.18-2ubuntu3 [162 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2 amd64 2.4.18-2ubuntu3 [86.6 kB]
Fetched 1,532 kB in 5s (270 kB/s)
Selecting previously unselected package libapr1:amd64.
(Reading database … 217703 files and directories currently installed.)
Preparing to unpack …/libapr1_1.5.2-3_amd64.deb …
Unpacking libapr1:amd64 (1.5.2-3) …
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack …/libaprutil1_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1:amd64 (1.5.4-1build1) …
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack …/libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack …/libaprutil1-ldap_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1-ldap:amd64 (1.5.4-1build1) …
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack …/liblua5.1-0_5.1.5-8ubuntu1_amd64.deb …
Unpacking liblua5.1-0:amd64 (5.1.5-8ubuntu1) …
Selecting previously unselected package apache2-bin.
Preparing to unpack …/apache2-bin_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2-bin (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2-utils.
Preparing to unpack …/apache2-utils_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2-utils (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2-data.
Preparing to unpack …/apache2-data_2.4.18-2ubuntu3_all.deb …
Unpacking apache2-data (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2.
Preparing to unpack …/apache2_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2 (2.4.18-2ubuntu3) …
Processing triggers for libc-bin (2.23-0ubuntu10) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Processing triggers for ufw (0.35-0ubuntu2) …
Setting up libapr1:amd64 (1.5.2-3) …
Setting up libaprutil1:amd64 (1.5.4-1build1) …
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …
Setting up libaprutil1-ldap:amd64 (1.5.4-1build1) …
Setting up liblua5.1-0:amd64 (5.1.5-8ubuntu1) …
Setting up apache2-bin (2.4.18-2ubuntu3) …
Setting up apache2-utils (2.4.18-2ubuntu3) …
Setting up apache2-data (2.4.18-2ubuntu3) …
Setting up apache2 (2.4.18-2ubuntu3) …
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.23-0ubuntu10) …
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Processing triggers for ufw (0.35-0ubuntu2) …
vskumar@ubuntu:~$
=== Apaches is installed ===>

Let us check its status:

== Status of apache2 ===>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ service status apache2
status: unrecognized service
vskumar@ubuntu:~$ service apache2 status
? apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
+-apache2-systemd.conf
Active: active (running) since Thu 2018-02-22 02:30:24 PST; 1min 6s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/apache2.service
+-12680 /usr/sbin/apache2 -k start
+-12683 /usr/sbin/apache2 -k start
+-12684 /usr/sbin/apache2 -k start

Feb 22 02:30:22 ubuntu systemd[1]: Starting LSB: Apache2 web server…
Feb 22 02:30:22 ubuntu apache2[12651]: * Starting Apache httpd web server apach
Feb 22 02:30:23 ubuntu apache2[12651]: AH00558: apache2: Could not reliably dete
Feb 22 02:30:24 ubuntu apache2[12651]: *
Feb 22 02:30:24 ubuntu systemd[1]: Started LSB: Apache2 web server.
lines 1-16/16 (END)
================>

Now, let us check the status for Jenkins:

===== Jenkins status ===>

vskumar@ubuntu:~$ service jenkins status
? jenkins.service – LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
Active: active (exited) since Thu 2018-02-22 02:13:57 PST; 23min ago
Docs: man:systemd-sysv-generator(8)

Feb 22 02:13:51 ubuntu systemd[1]: Starting LSB: Start Jenkins at boot time…
Feb 22 02:13:51 ubuntu jenkins[10140]: * Starting Jenkins Automation Server jen
Feb 22 02:13:52 ubuntu su[10168]: Successful su for jenkins by root
Feb 22 02:13:52 ubuntu su[10168]: + ??? root:jenkins
Feb 22 02:13:52 ubuntu su[10168]: pam_unix(su:session): session opened for user
Feb 22 02:13:57 ubuntu jenkins[10140]: …done.
Feb 22 02:13:57 ubuntu systemd[1]: Started LSB: Start Jenkins at boot time.
lines 1-12/12 (END)
==== Jenkins is running ======>

How to check on browser in Ubuntu for Jenkins web page ?:

You can also check the ubuntu browser with the below
url:http://localhost:8080/login?from=%2F
There should be a web page displayed with the message:
“Unlock Jenkins”.

It means Jenkins is available to use.

Step6:
Now, we need to setup the admin password.
Read the content on the web page.
You are advised to use the initial password from:
/var/lib/jenkins/secrets/initialAdminPassword

Let us go to that directory to get copy and paste it on
web page.

In my case I got the below:
==== PWD display ===>
vskumar@ubuntu:~$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
711a4d7d01244651a490cfd4a61439e2
vskumar@ubuntu:~$
========>

I have pasted it on web page.
Till you change the pwd, this will be the default one.

==== List of the files in jenkins dir ===>
vskumar@ubuntu:/var/lib/jenkins$ ls -l
total 60
-rw-r–r– 1 jenkins jenkins 1820 Feb 22 02:17 config.xml
-rw-r–r– 1 jenkins jenkins 156 Feb 22 02:15 hudson.model.UpdateCenter.xml
-rw——- 1 jenkins jenkins 1712 Feb 22 02:15 identity.key.enc
-rw-r–r– 1 jenkins jenkins 94 Feb 22 02:16 jenkins.CLI.xml
-rw-r–r– 1 jenkins jenkins 6 Feb 22 02:16 jenkins.install.UpgradeWizard.state
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 jobs
drwxr-xr-x 3 jenkins jenkins 4096 Feb 22 02:16 logs
-rw-r–r– 1 jenkins jenkins 907 Feb 22 02:16 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 nodes
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 plugins
-rw-r–r– 1 jenkins jenkins 64 Feb 22 02:15 secret.key
-rw-r–r– 1 jenkins jenkins 0 Feb 22 02:15 secret.key.not-so-secret
drwx—— 4 jenkins jenkins 4096 Feb 22 02:16 secrets
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:18 updates
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:16 userContent
drwxr-xr-x 3 jenkins jenkins 4096 Feb 22 02:16 users
vskumar@ubuntu:/var/lib/jenkins$ cd jobs
vskumar@ubuntu:/var/lib/jenkins/jobs$ ls
vskumar@ubuntu:/var/lib/jenkins/jobs$ pwd
/var/lib/jenkins/jobs
vskumar@ubuntu:/var/lib/jenkins/jobs$
==================>
We need to remember the above directories.

By default we can install ‘suggested plugins’ for now.
It shows the plugins updates.
Once they are installed, you will be prompted for a uid/pwd/name/e-mail.
You can fill them, and start using jenkins.

That is all the installation of Jenkins 2.9.

 

This video is made to motivate the new DevOps engineers to learn and do a kind of trouble shooting, while doing Jenkins installation on a Virtual machine of Ubuntu.

To try one job build you can go through my another blog:

https://vskumar.blog/2017/11/26/2-devops-jenkins2-9-how-to-create-and-build-the-job/

Good luck!! and you can start practicing Jenkins.

 

Vcard-Shanthi Kumar V-v3

 

14. DevOps: Creating a data volume with couchdb

Docker-logo

How to create Data Volumes using docker containers?:

In this exercise I would like to create couchdb data volume as below under docker container
Use the below command to make a couchdb volume

Step1:
Make directory data-volume1
===== Commands output =====>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ ls
Desktop Downloads Music Public Videos
Documents examples.desktop Pictures Templates
vskumar@ubuntu:~$ mkdir data-volume1
vskumar@ubuntu:~$ ls
data-volume1 Documents examples.desktop Pictures Templates
Desktop Downloads Music Public Videos
vskumar@ubuntu:~$ cd data-volume1
vskumar@ubuntu:~/data-volume1$
=======================================>

Step2: I need to pull the couchdb latest image from the docker hub as below:

docker pull couchdb Using default tag:latest

=== Output =======>
vskumar@ubuntu:~/data-volume1$ sudo docker pull couchdb
Using default tag: latest
latest: Pulling from library/couchdb
4176fe04cefe: Pull complete
9f0a7c716711: Pull complete
796517a7b990: Pull complete
003491b79092: Pull complete
1502aa8b5925: Pull complete
d4017d9fa68f: Pull complete
30bc291a9bfe: Pull complete
4018e1354d8f: Pull complete
ebef40645ea4: Pull complete
f11931e5cbae: Pull complete
Digest: sha256:b95dce63ab64991640e5c9d4cc1597055690b1c1bb79ab30829d498f5f2301fcStatus: Downloaded newer image for couchdb:latest
vskumar@ubuntu:~/data-volume1$
=============================>

Step3:

Now, use the below command to create the data instance
==================>
vskumar@ubuntu:~/data-volume1$ sudo docker run -d –name my-couchdb couchdb
f84f95c5c9d2bdcabfb0ef796cb3e9b3bef0cec64ef4349d46f250a9065aa399
vskumar@ubuntu:~/data-volume1$
===================>
The above image includes EXPOSE 5984 (the CouchDB port),
so standard container linking will make it automatically available to the
linked containers.

Now, let me check the running containers:

====== List of containers along with couchdb ===>
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7cba170d39a couchdb “tini — /docker-ent…” 5 minutes ago Up 5 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb-app
f84f95c5c9d2 couchdb “tini — /docker-ent…” 6 minutes ago Up 6 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb
10ffea6140f9 ubuntu “bash” 2 months ago Exited (0) 2 months ago quizzical_lalande
b2a79f8d2fe6 ubuntu “/bin/bash -c ‘while…” 2 months ago Exited (255) 2 months ago goofy_borg
155f4b0764b1 ubuntu:16.04 “/bin/bash” 2 months ago Exited (0) 2 months ago zen_volhard
vskumar@ubuntu:~$

vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7cba170d39a couchdb “tini — /docker-ent…” 6 minutes ago Up 6 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb-app
f84f95c5c9d2 couchdb “tini — /docker-ent…” 8 minutes ago Up 8 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb
vskumar@ubuntu:~$
==============================>

Step4:

Now, we need to use the couchdb instance:
sudo docker run –name my-couchdb-app –link my-couchdb:couch couchdb

============>
Please note when I executed the above command in CLI, it started the DB server and
working as a dedicated terminal with its continuous display.
Now, we can not use the same terminal.
Hence I opened another terminal

===============>

From another terminal:
======= Current status ====>
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7cba170d39a couchdb “tini — /docker-ent…” 10 minutes ago Up 9 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb-app
f84f95c5c9d2 couchdb “tini — /docker-ent…” 11 minutes ago Up 11 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb
10ffea6140f9 ubuntu “bash” 2 months ago Exited (0) 2 months ago quizzical_lalande
b2a79f8d2fe6 ubuntu “/bin/bash -c ‘while…” 2 months ago Exited (255) 2 months ago goofy_borg
155f4b0764b1 ubuntu:16.04 “/bin/bash” 2 months ago Exited (0) 2 months ago zen_volhard
vskumar@ubuntu:~$

zen_volhard
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7cba170d39a couchdb “tini — /docker-ent…” 10 minutes ago Up 10 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb-app
f84f95c5c9d2 couchdb “tini — /docker-ent…” 12 minutes ago Up 12 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb
vskumar@ubuntu:~$
===========================>

Step5:

Now, we need to attach this couchdb volumes to a local directory:

sudo docker run -d -v $(pwd):/opt/couchdb/data –name my-couchdb couchdb
To execute the above command, I need to remove the existing container and re-execute.

======= Removing the container forcedly ====>
vskumar@ubuntu:~$ sudo docker rm -f b7cba170d39a
b7cba170d39a
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f84f95c5c9d2 couchdb “tini — /docker-ent…” 19 minutes ago Up 19 minutes 4369/tcp, 5984/tcp, 9100/tcp my-couchdb
10ffea6140f9 ubuntu “bash” 2 months ago Exited (0) 2 months ago quizzical_lalande
b2a79f8d2fe6 ubuntu “/bin/bash -c ‘while…” 2 months ago Exited (255) 2 months ago goofy_borg
155f4b0764b1 ubuntu:16.04 “/bin/bash” 2 months ago Exited (0) 2 months ago zen_volhard
vskumar@ubuntu:~$ sudo docker rm -f f84f95c5c9d2
f84f95c5c9d2
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10ffea6140f9 ubuntu “bash” 2 months ago Exited (0) 2 months ago quizzical_lalande
b2a79f8d2fe6 ubuntu “/bin/bash -c ‘while…” 2 months ago Exited (255) 2 months ago goofy_borg
155f4b0764b1 ubuntu:16.04 “/bin/bash” 2 months ago Exited (0) 2 months ago zen_volhard
vskumar@ubuntu:~$
============ You can see there are no couchdb containers now=====>
Let us recreate it with the below command:
sudo docker run -d -v $(pwd):/opt/couchdb/data –name mytest-couchdb couchdb

=== re-creating a couchdb instance ===================>

vskumar@ubuntu:~/data-volume1$ sudo docker run -d -v $(pwd):/opt/couchdb/data –name mytest-couchdb couchdb
[sudo] password for vskumar:
ac849b4905d712740b7f5972e13836552914e7fdfd37e06dc2ecb6697a22c7dc
vskumar@ubuntu:~/data-volume1$

vskumar@ubuntu:~/data-volume1$ ls
_dbs.couch _nodes.couch _replicator.couch _users.couch
vskumar@ubuntu:~/data-volume1$ ls -l
total 44
-rw-r–r– 1 vskumar 999 4240 Feb 17 06:10 _dbs.couch
-rw-r–r– 1 vskumar 999 8368 Feb 17 06:10 _nodes.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _replicator.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _users.couch
vskumar@ubuntu:~/data-volume1$
=================================?

Step5:

Now we need to Specify the admin user in the DB environment:

We can use the two environment variables COUCHDB_USER and COUCHDB_PASSWORD to
set up the admin user.

$ sudo docker run -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password -d couchdb

===== Creating User and PWD =========>
vskumar@ubuntu:~/data-volume1$ sudo docker run -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password -d couchdb
4af58b1eed0e71ec11e0ea4cdf918ff657c36d312cfbf32ea0e2a7d7e9e23ee5
vskumar@ubuntu:~/data-volume1$
================================>

Step6:

Now let us create the below files:

======== .ini file ====>
vskumar@ubuntu:~/data-volume1$
vskumar@ubuntu:~/data-volume1$ ls -l
total 52
-rw-r–r– 1 vskumar 999 4240 Feb 17 06:10 _dbs.couch
-rw-rw-r– 1 vskumar vskumar 49 Feb 17 06:32 dockerfile
-rw-rw-r– 1 vskumar vskumar 49 Feb 17 06:29 local.ini
-rw-r–r– 1 vskumar 999 8368 Feb 17 06:10 _nodes.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _replicator.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _users.couch
vskumar@ubuntu:~/data-volume1$ cat local.ini

writer = file
file = /opt/couchdb/log/couch.log
=========== Creating a dockerfile in the current dir =====>
vskumar@ubuntu:~/data-volume1$ cat dockerfile

FROM couchdb

COPY local.ini /opt/couchdb/etc/

vskumar@ubuntu:~/data-volume1$
========================>
Now, we need to tag the db as below:

=====================>
vskumar@ubuntu:~/data-volume1$ sudo docker build -t mytest-couchdb .
Sending build context to Docker daemon 40.45kB
Step 1/2 : FROM couchdb
—> af415fd5efda
Step 2/2 : COPY local.ini /opt/couchdb/etc/
—> b88156204d48
Successfully built b88156204d48
Successfully tagged mytest-couchdb:latest
vskumar@ubuntu:~/data-volume1$
=========================>

Now, let us map the port as below:
The default port of couchdb is 5984.
$ sudo docker run -d -p 5984:5984 mytest-couchdb

=================================>
vskumar@ubuntu:~/data-volume1$
vskumar@ubuntu:~/data-volume1$ sudo docker run -d -p 5984:5984 mytest-couchdb
a9e5e6e6abc30c32830a0d3b70e7fe203d63dbd2de974d0dd02d1ccf0b53232e
vskumar@ubuntu:~/data-volume1$
==============>
My current docker host ip is 172.17.0.1
I would like to curl to the cocuchdb port 5984 as below to test its availability:

sudo curl -X PUT http://172.17.0.1:5984/db
=========================>
vskumar@ubuntu:~/data-volume1$ sudo curl -X PUT http://172.17.0.1:5984/db
{“ok”:true}
vskumar@ubuntu:~/data-volume1$
===== The couchdb data volume is available to use =================>

Step7:

Now, let me test this db by adding a document as below:

sudo curl -H ‘Content-Type: application/json’ -X POST http://172.17.0.1:5984/db -d ‘{“value”: “Hello I am Shanthi Kumar V, Testing my couchdb instance in a docker container”}’

============== Adding document into couchdb =======>
vskumar@ubuntu:~/data-volume1$ ls -l
total 52
-rw-r–r– 1 vskumar 999 4240 Feb 17 06:10 _dbs.couch
-rw-rw-r– 1 vskumar vskumar 49 Feb 17 06:32 dockerfile
-rw-rw-r– 1 vskumar vskumar 49 Feb 17 06:29 local.ini
-rw-r–r– 1 vskumar 999 8368 Feb 17 06:10 _nodes.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _replicator.couch
-rw-r–r– 1 vskumar 999 8374 Feb 17 06:10 _users.couch
vskumar@ubuntu:~/data-volume1$ date
Sat Feb 17 06:52:48 PST 2018
vskumar@ubuntu:~/data-volume1$ sudo curl -H ‘Content-Type: application/json’ -X POST http://172.17.0.1:5984/db -d ‘{“value”: “Hello I am Shanthi Kumar V, Testing my couchdb instance in a docker container”}’
{“ok”:true,”id”:”4c3e6b9ece5a89445768618cad000ebc”,”rev”:”1-3514063c0977a3ab2a955a8498db6460″}
vskumar@ubuntu:~/data-volume1$
==================================>
Please note
“id”:”4c3e6b9ece5a89445768618cad000ebc” is the document id in couchdb.
Now let us check in the db as below:
I am using the document id:4c3e6b9ece5a89445768618cad000ebc

sudo curl http://172.17.0.1:5984/db/4c3e6b9ece5a89445768618cad000ebc

You can see the db output:
============= couch db ouput =====>
vskumar@ubuntu:~/data-volume1$
vskumar@ubuntu:~/data-volume1$ sudo curl http://172.17.0.1:5984/db/4c3e6b9ece5a89445768618cad000ebc
{“_id”:”4c3e6b9ece5a89445768618cad000ebc”,”_rev”:”1-3514063c0977a3ab2a955a8498db6460″,”value”:”Hello I am Shanthi Kumar V, Testing my couchdb instance in a docker container”}
vskumar@ubuntu:~/data-volume1$
===================================>

Step8:

Let us experiment it with one more new container:

===== Current containers =====>
vskumar@ubuntu:~/data-volume1$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9e5e6e6abc3 mytest-couchdb “tini — /docker-ent…” 21 minutes ago Up 21 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp compassionate_goldwasser
4af58b1eed0e couchdb “tini — /docker-ent…” About an hour ago Up About an hour 4369/tcp, 5984/tcp, 9100/tcp cocky_lamarr
ac849b4905d7 couchdb “tini — /docker-ent…” About an hour ago Up About an hour 4369/tcp, 5984/tcp, 9100/tcp mytest-couchdb
vskumar@ubuntu:~/data-volume1$
================================>
Now, let us try to kill the above containers one by one and check the status:

======= Kill all couchdb containers ====>
vskumar@ubuntu:~/data-volume1$ sudo docker kill a9e5e6e6abc3
a9e5e6e6abc3
vskumar@ubuntu:~/data-volume1$ sudo docker kill 4af58b1eed0e
4af58b1eed0e
vskumar@ubuntu:~/data-volume1$ sudo docker kill ac849b4905d7
ac849b4905d7
vskumar@ubuntu:~/data-volume1$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
vskumar@ubuntu:~/data-volume1$

============No active containers ===========>

sudo docker build -t vskumar-couchdb .

=========== Tagging to new container ======>
vskumar@ubuntu:~/data-volume1$ sudo docker build -t vskumar-couchdb .
Sending build context to Docker daemon 40.45kB
Step 1/2 : FROM couchdb
—> af415fd5efda
Step 2/2 : COPY local.ini /opt/couchdb/etc/
—> Using cache
—> b88156204d48
Successfully built b88156204d48
Successfully tagged vskumar-couchdb:latest
vskumar@ubuntu:~/data-volume1$
===========================>

sudo docker run -d -p 5984:5984 vskumar-couchdb

====== We can see the current active container as vskumar-couchdb =====>
vskumar@ubuntu:~/data-volume1$ sudo docker run -d -p 5984:5984 vskumar-couchdb
0f53e91f24950966ad03f2d9c0cefa97119e3a7321e947e53ed1f6a245e4e9a7
vskumar@ubuntu:~/data-volume1$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f53e91f2495 vskumar-couchdb “tini — /docker-ent…” 11 seconds ago Up 8 seconds 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp nervous_spence
vskumar@ubuntu:~/data-volume1$
========================>

Now we can insert a new document as below into this new container:
==================>
vskumar@ubuntu:~/data-volume1$
vskumar@ubuntu:~/data-volume1$ sudo curl -H ‘Content-Type: application/json’ -X POST http://172.17.0.1:5984/db -d ‘{“value”: “Hello I am Shanthi Kumar V, Testing my couchdb 2nd—>instance in a new docker container”}’
{“ok”:true,”id”:”c683de9d91bb7628c5428e521e00047a”,”rev”:”1-beade1bc7636c3b41126b9c867a47028″}
vskumar@ubuntu:~/data-volume1$
=================>
The document “id”:”c683de9d91bb7628c5428e521e00047a”.
Let us check in db:

sudo curl http://172.17.0.1:5984/db/c683de9d91bb7628c5428e521e00047a
============= Results ====>
vskumar@ubuntu:~/data-volume1$ sudo curl http://172.17.0.1:5984/db/c683de9d91bb7628c5428e521e00047a
{“_id”:”c683de9d91bb7628c5428e521e00047a”,”_rev”:”1-beade1bc7636c3b41126b9c867a47028″,”value”:”Hello I am Shanthi Kumar V, Testing my couchdb 2nd—>instance in a new docker container”}
vskumar@ubuntu:~/data-volume1$
===========================>
So, we found the inserted record.

At this point I want to stop this couchdb container exercise.

Vcard-Shanthi Kumar V-v3