Integration of Dockerfile, Jenkins, Git to launch the respective OS in RHEL8 using SSH from Docker Container

Before Starting my task description lemme introduce each keyword in above time …………

Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.[6] Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Solomon Hykes

Jenkins is a free and open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, ClearCase and RTC, and can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands. The creator of Jenkins is Kohsuke Kawaguchi.[4] Released under the MIT License, Jenkins is free software.

Git is a distributed version-control system for tracking changes in source code during software development.[8] It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed,data integrity, and support for distributed, non-linear workflows.Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano. As with most other distributed version-control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server.

So let back to our task…….

When a Developer uploads the code to Github then according to the type of file like HTML, PHP, etc, an OS had launched from the docker in the RHEL8 with the respective software install in it.

This whole process done by the Jenkins jobs, but here Jenkins is running in the Docker container, so to launch the OS in RHEL8 we use SSH terminal commands or SSH plugin in Jenkins.

Tools required to complete our task …😊😊

  1. Docker

2. RHEL8

3. Jenkins

4. Git

5. Github

so lets get dive in the world of technology with me🏄‍♀️🏄‍♀️

Then use the command #docker build -t Jenkins:v1 /ws/

to create an image

when we launch a container from this image it automatically installs wget, git, sudo, java required for Jenkins, Jenkins, and start the service of Jenkins at the port 8080.

For the first time, we have to set up Jenkins by giving a password, installing various Plugins.

This password can be copied from the location given in the image or when we launch the container, it also gives at that time.

installation of various Plugins

before we move to create the jobs in Jenkins, first make an SSH connection…..

                            ssh -keygen

After ssh -you have to put username@remotehostIP

it’s an important information so i am not sharing any screenshot for this step 😊😊

This job downloads the file in the docker container workspace whenever a Developer pushes the file to the respective Github repository. Also, I used scp command — to copy the file in the RHEL8 directory. POLL SCM is used to check every minute whether the new file is uploaded on Github or not.

By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).

Test your app if it is working or not, if app is not working, then send an email to developer with error messages.

Testing Result….

Creating One extra job to monitor: If the container where the app is running. fails due to any reason then this job should automatically start the container again.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sakshi Tripathi

Redhat Ansible || Flutter || EKS || Hybrid_Multi_Cloud || MLOps Trainee at LinuxWorld Informatics Pvt Ltd, Pursuing my ambition and gaining knowledge