CI/CD pipeline using Docker and Jenkins. Step by step

CI/CD pipeline using Docker and Jenkins. Step by step
Average rating: 1
(6 votes)

To understand what is DevOps first you need to learn about its life cycle. Our task is to automate the entire process, from the development process to the time we get it into production. That’s the time when we need Continuous Integration/Continuous Deployment skills. Let’s present you the CI/CD pipeline using Docker and Jenkins. Step by step.

You get all the features of the code, merge them and use a compiler to compile it. This whole process is called the build phase. Then you move on to the testing phase. Here we have various kinds of testing. Then you move on to the deploy phase, where you deploy it into a staging or a test server. You can run another set of a sanity test. If it’s ok, then it can be deployed to production. This process continues until we get a code that can be deployed in the production server where we measure and validate the code.

Jenkins has many tools in order to automate the entire process. So what happens, Jenkins takes over from there which is a front-end tool where you can define your entire job or the task.  Then it moves on to the staging server to deploy it using Docker. After a series of tests, it moves to production.

Let us now look at this process step by step:

  1. Open your terminal in your VM. Start Jenkins and Docker using the commands “systemctl start jenkins“, “systemctl enable jenkins“, “systemctl start docker“.
  2. Open your Jenkins on your specified port. Click on New Item to create a Job.
  3. Select freestyle project and write the item name and click OK.
  4. Select Source Code Management and provide the Git repository. Click on Apply and Save button.
  5. Click on Build->Select Execute Shell
  6. Provide the shell commands.
  7. Create the new Job by clicking on New Item
  8. Select freestyle project and provide the item name
  9. Select Source Code Management and provide the Git repository.
  10. Then click on Build->Select Execute Shell
  11. Provide the shell commands.
  12. Create the new Job by clicking on New Item
  13.  Select freestyle project and provide the item name
  14. Select Source Code Management and provide the Git repository.
  15. Then click on Build->Select Execute Shell
  16. Provide the shell commands.
  17. Click on Job1 -> Configure.
  18. Click on Post-build Actions -> Build other projects.
  19. Provide the project name.
  20. Select Build Pipeline View and provide the view name
  21. Select the initial Job
  22. Click on Run button to start the CI CD process.
  23. After successful build open localhost:8180/sample.text. It will run the application.

That’s how it works. Nothing to worry about. Find more examples here.

Need more details on Docker? Here you go. Portable Node development environment with Docker. Enjoy!

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

*By submitting this form you agree with our Privacy Policy.

Mailing & Legal Address

Syndicode Inc. 340 S Lemon Ave #3299, Walnut CA, 91789, USA

Visiting & Headquarters address
Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
Email info@syndicode.com
Phone (+1) 9035021111