DevOps - Unit - 4
DevOps - Unit - 4
Continuous Delivery
• Importance of Continuous Delivery
• Continuous Deployment: CD Flow
• Containerization with Docker: Introduction to Docker
• Docker Installation
• Docker commands
• Images & Containers
• DockerFile
• Running containers
• working with containers and publish to Docker Hub.
Importance of Continuous Delivery
• Continuously delivering value has become a mandatory
requirement for organizations.
• To deliver value to your end users, you must release
continually and without errors.
• Continuous delivery (CD) is the process of automating
build, test, configuration, and deployment from a build to
a production environment.
• A release pipeline can create multiple testing or staging
environments to automate infrastructure creation and
deploy new builds.
• Successive environments support progressively longer-
running integration, load, and user acceptance testing
activities.
Continous Delivery Apporach
Before Continuous Delivery
• Before Continuous Delivery software release cycles were a
bottleneck for application and operations teams.
• These teams often relied on manual handoffs that resulted in issues
during release cycles.
• Manual processes led to unreliable releases that produced delays
and errors.
After Continuous Delivery
• CD is a lean practice, with the goal to keep production fresh with
the fastest path from new code or component availability to
deployment.
• Automation minimizes the time to deploy and time to mitigate
(TTM) or time to remediate (TTR) production incidents.
• In lean terms, CD optimizes process time and eliminates idle time.
What is Continuous Deployment (CD)?
• Continuous Deployment (CD) is the continuation of
Continuous Integration.
• Once the tests have been validated in the dev
environment, they must be deployed to production.
Continuous deployment, therefore, consists of automating
deployment actions that were previously performed
manually.
• This is why we often talk about CI/CD together.
• To automate deployment actions, tests on the qualification
environment need to be automated to ensure that the new
functionality to be pushed works properly.
Continuous Delivery vs Continuous Deployment
• With continuous delivery, every code change is built, tested, and
then pushed to a non-production testing or staging environment.
• Docker images are also the starting point for anyone using Docker
for the first time.
• You can create a Docker image by using one of two methods:
Interactive: By running a container from an existing Docker image,
manually changing that container environment through a series of live
steps, and saving the resulting state as a new image.
Dockerfile: By constructing a plain-text file, known as a Dockerfile,
which provides the specifications for creating a Docker image.
• Image Layers :
• Each of the files that make up a Docker image is known as a layer.
• These layers form a series of intermediate images, built one on top of the
other in stages, where each layer is dependent on the layer immediately
below it.
• The hierarchy of your layers is key to efficient lifecycle management of
your Docker images.
• You should organize layers that change most often as high up the stack as
possible.
• This is because, when you make changes to a layer in your image, Docker
not only rebuilds that particular layer, but all layers built from it.
• Therefore, a change to a layer at the top of a stack involves the least
amount of computational work to rebuild the entire image.
• Container Layer
• Each time Docker launches a container from an image, it adds a thin
writable layer, known as the container layer, which stores all
changes to the container throughout its runtime.
How to Create a Docker Image
• The following is a set of simplified steps to creating an image
interactively:
• Install Docker and launch the Docker engine
• Open a terminal session
• Use the following Docker run command to start an interactive shell
session with a container launched from the image specified
by image_name:tag_name:
• If you omit the tag name, then Docker automatically pulls the most
recent image version, which is identified by the latest tag.
• If Docker cannot find the image locally then it will pull what it
needs to build the container from the appropriate repository on
Docker Hub.
• In our example, we’ll launch a container environment based on the
latest version of Ubuntu:
• Now configure your container environment by, for example,
installing all the frameworks, dependencies, libraries, updates, and
application code you need. The following simple example adds an
NGINX server: