Continuous Delivery with Docker and Jenkins
eBook - ePub

Continuous Delivery with Docker and Jenkins

Rafal Leszko

Share book
  1. 332 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Continuous Delivery with Docker and Jenkins

Rafal Leszko

Book details
Book preview
Table of contents
Citations

About This Book

Unleash the combination of Docker and Jenkins in order to enhance the DevOps workflowAbout This Book• Build reliable and secure applications using Docker containers.• Create a complete Continuous Delivery pipeline using Docker, Jenkins, and Ansible.• Deliver your applications directly on the Docker Swarm cluster.• Create more complex solutions using multi-containers and database migrations.Who This Book Is ForThis book is indented to provide a full overview of deep learning. From the beginner in deep learning and artificial intelligence to the data scientist who wants to become familiar with Theano and its supporting libraries, or have an extended understanding of deep neural nets.Some basic skills in Python programming and computer science will help, as well as skills in elementary algebra and calculus.What You Will Learn• Get to grips with docker fundamentals and how to dockerize an application for the Continuous Delivery process• Configure Jenkins and scale it using Docker-based agents• Understand the principles and the technical aspects of a successful Continuous Delivery pipeline• Create a complete Continuous Delivery process using modern tools: Docker, Jenkins, and Ansible• Write acceptance tests using Cucumber and run them in the Docker ecosystem using Jenkins• Create multi-container applications using Docker Compose• Managing database changes inside the Continuous Delivery process and understand effective frameworks such as Cucumber and Flyweight• Build clustering applications with Jenkins using Docker Swarm• Publish a built Docker image to a Docker Registry and deploy cycles of Jenkins pipelines using community best practicesIn DetailThe combination of Docker and Jenkins improves your Continuous Delivery pipeline using fewer resources. It also helps you scale up your builds, automate tasks and speed up Jenkins performance with the benefits of Docker containerization.This book will explain the advantages of combining Jenkins and Docker to improve the continuous integration and delivery process of app development. It will start with setting up a Docker server and configuring Jenkins on it. It will then provide steps to build applications on Docker files and integrate them with Jenkins using continuous delivery processes such as continuous integration, automated acceptance testing, and configuration management.Moving on you will learn how to ensure quick application deployment with Docker containers along with scaling Jenkins using Docker Swarm. Next, you will get to know how to deploy applications using Docker images and testing them with Jenkins.By the end of the book, you will be enhancing the DevOps workflow by integrating the functionalities of Docker and Jenkins.Style and approachThe book is aimed at DevOps Engineers, developers and IT Operations who want to enhance the DevOps culture using Docker and Jenkins.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Continuous Delivery with Docker and Jenkins an online PDF/ePUB?
Yes, you can access Continuous Delivery with Docker and Jenkins by Rafal Leszko in PDF and/or ePUB format, as well as other popular books in Computer Science & Software Development. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781787126145
Edition
1

Introducing Docker

We will discuss how the modern Continuous Delivery process should look by introducing Docker, the technology that changed the IT industry and the way the servers are used.
This chapter covers the following points:
  • Introducing the idea of virtualization and containerization
  • Installing Docker for different local and server environments
  • Explaining the architecture of the Docker toolkit
  • Building Docker images with Dockerfile and by committing changes
  • Running applications as Docker containers
  • Configuring Docker networks and port forwarding
  • Introducing Docker volumes as a shared storage

What is Docker?

Docker is an open source project designed to help with application deployment using software containers. This quote is from the official Docker page:
"Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries - anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment."
Docker, therefore, in a similar way as virtualization, allows packaging an application into an image that can be run everywhere.

Containerization versus virtualization

Without Docker, isolation and other benefits can be achieved with the use of hardware virtualization, often called virtual machines. The most popular solutions are VirtualBox, VMware, and Parallels. A virtual machine emulates a computer architecture and provides the functionality of a physical computer. We can achieve complete isolation of applications if each of them is delivered and run as a separate virtual machine image. The following figure presents the concept of virtualization:
Each application is launched as a separate image with all dependencies and a guest operating system. Images are run by the hypervisor, which emulates the physical computer architecture. This method of deployment is widely supported by many tools (such as Vagrant) and dedicated to development and testing environments. Virtualization, however, has three significant drawbacks:
  • Low performance: The virtual machine emulates the whole computer architecture to run the guest operating system, so there is a significant overhead associated with each operation.
  • High resource consumption: Emulation requires a lot of resources and has to be done separately for each application. This is why, on a standard desktop machine, only a few applications can be run simultaneously.
  • Large image size: Each application is delivered with a full operating system, so the deployment on a server implies sending and storing a large amount of data.
The concept of containerization presents a different solution:
Each application is delivered together with its dependencies, but, without the operating system. Applications interface directly with the host operating system, so there is no additional layer of the guest operating system. It results in better performance and no waste of resources. Moreover, shipped Docker images are significantly smaller.
Notice that in the case of containerization, the isolation happens at the level of the host operating system's processes. It doesn't mean, however, that the containers share their dependencies. Each of them has their own libraries in the right version, and if any of them is updated, it has no impact on the others. To achieve this, Docker Engine creates a set of Linux namespaces and control groups for the container. This is why the Docker security is based on the Linux kernel process isolation. This solution, although mature enough, could be considered slightly less secure than the complete operating system-based isolation offered by virtual machines.

The need for Docker

Docker containerization solves a number of problems seen in traditional software delivery. Let's take a closer look.

Environment

Installing and running software is complex. You need to decide about the operating system, resources, libraries, services, permissions, other software, and everything your application depends on. Then, you need to know how to install it. What's more, there may be some conflicting dependencies. What do you do then? What if your software needs an upgrade of a library but the other does not? In some companies, such issues are solved by having classes of applications, and each class is served by a dedicated server, for example, a server for web services with Java 7, another one for batch jobs with Java 8, and so on. This solution, however, is not balanced in terms of resources and requires an army of IT operations teams to take care of all production and test servers.
Another problem with the environment complexity is that it often requires a specialist to run an application. A less technical person may have a hard time setting up MySQL, ODBC, or any other slightly more sophisticated tool. This is particularly true for applications not delivered as an operating system-specific binary but which require source code compilation or any other environment-specific configuration.

Isolation

Keep the workspace tidy. One application can change the behavior of the other one. Imagine what can happen. Applications share one filesystem, so if application A writes something to the wrong directory, application B reads the incorrect data. They share resources, so if there is a memory leak in application A, it can freeze not only itself but also application B. They share network interfaces, so if applications A and B both use port 8080, one of them will crash. Isolation concerns the security aspects too. Running a buggy application or malicious software can cause damage to other applications. This is why it is a much safer approach to keep each application inside a separate sandbox, which limits the scope of damage impact to the application itself.

Organizing applications

Servers often end up looking messy with a ton of running applications nobody knows anything about. How will you check what applications are running on the server and what dependencies each of them is using? They could depend on libraries, other applications, or tools. Without the exhaustive documentation, all we can do is look at the running processes and start guessing. Docker keeps things organized by having each application as a separate container that can be listed, searched, and monitored.

Portability

Write once, run anywhere, said the slogan while advertising the earliest versions of Java. Indeed, Java addresses the portability issue quite well; however, I can still think of a few cases where it fails, for example, the incompatible native dependencies or the older version of the Java runtime. Moreover, not all software ...

Table of contents