Simply Jenkins is an automation server . Which means any activity which we want we can use Jenkins to automate it . Automation server’s is something with which we can continuously integrate and continuous deliver . We will learn how to integrate Jenkins with Git ,Maven ,Docker, AWS ,Ansible etc
Become a DevOps Master learning Jenkins & integrations with powerful tools like Docker, Ansible, AWS, GIT & more!
create a Linux VM because we will simulate a real world environment. go ahead and Install VirtualBox if you are using Windows. https://www.virtualbox.org/wiki/Downloads.
Create VM using Virtual Machines using Virtual box in Windows to create real world scenarios .
download centos minimal iso file or Redhat minimal iso file .
Create VM using downloaded ISO file in Oracle VM Virtual box. Configure network , Ethernet and etc then our VM is ready .
Jenkins not coming up in the Docker Container ?
There’s a chance that your jenkins container won’t come up. If you can’t see your container by using
docker ps, this will help! Otherwise, you can just ignore it
docker ps doesn’t show the running container.
docker ps -a shows the container with exit status.
docker logs jenkins shows a volume permission error.
* Inside of the Jenkins container, there’s a user named “jenkins” which has a Linux uid of Jenkins.
* You are mounting a docker volume to /var/jenkins_home which is the home directory of that user. If the directory doesn’t have Jenkins userid permissions, then the user won’t be able to write/delete files, which causes the container to exit.
Apply 1000 permissions to your jenkins-data folder, and then restart the container.
sudo chown jenkins:jenkins -R ~/jenkins-data docker-compose up -d
Configuring local DNS on the windows server by editing hosts file located in the below path.
Add IP Hostname at the end of the file
to display the running docker containers
docker exec -ti Jenkins bash
this will give the bash terminal of the Jenkins Container
to come out of the docker container
Each job in the Jenkins has it own Console log . If there is a failure or want to see what happened in the job we can go to console log and verify .
docker cp test.sh Jenkins:/tmp/
This will copy the file from VM to Docker container .
ssh-keygen -f userid
Above command will generate 2 files one is userid.pub and userid . Here one is a public key and another is a private key . Keep private key safely and securily . We will use this for securely connecting to a remote server using SSH .
There will he key exchange required between source and remote server for password less communication where source public key need to be copied in to destination server and configure .
copy userid.pub to /home/remoteuser/.ssh/authorized_keys
to generate keys on the server
This is to run the sshd service
List of images available in the system
docker ps –> to see the running container
docker-compse up -d –> to read and process the config left or newly added to bring up the new container .docker-compose.yml file has the actual configuration
ssh -I useridprivatekey remote@host
using -iOption and private key it will not ask for the password while connecting