INSTALLING DOCKER
- sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
- yum install docker
- Command to pull docker image
- docker pull jenkins/jenkins:2.89.4
INSTALLING JENKINS MASTER AS DOCKER CONTAINER
COMMAND
- Command to run docker
- docker run -d -u root -p 8080:8080 -p 50000:50000 –privileged –restart always -v /var/jenkins_home:/var/jenkins_home jenkins/jenkins:2.89.4
- Command to check whether docker started or not
- docker ps –a
Configuring CLI Jenkins
Jenkins has a built-in command line interface that allows you to access Jenkins from a script or from your shell. This is convenient for automation of routine tasks, bulk updates, trouble diagnosis, and so on.
This interface is accessed via the Jenkins CLI client, which is a Java JAR file distributed with Jenkins.
- command to download Jenkins-cli.jar file
- wget -P /var/jenkins_home/ http://<<IP ADDRESS>>:8080/jnlpJars/jenkins-cli.jar
- Setting JENKINS_URL variable
- echo “JENKINS_URL=’http://<<IP ADDRESS>>:8080‘” >> /etc/environment
- Setting Jenkins-cli as alias for running Jenkins-cli.jar
- echo “alias jenkins-cli=’java -jar /var/lib/jenkins/jenkins-cli.jar'” >> ~/.bashrc
- Authenticate the jenkins
- Command to install plugin from CLI
- jenkins-cli install-plugin thinBackup –restart
- jenkins-cli -auth @jenkinsauth build FOLDER1/Coberutra-Examp
- jenkins-cli -auth @jenkinsauth list-jobsle