Software Engineering-Week-12
Software Engineering-Week-12
(Week-12)
USAMA MUSHARAF
LECTURER (Department of Computer
Science)
FAST-NUCES PESHAWAR
CONTENT OF WEEK # 12
Software Deployment
Large scale software deployment
Virtualization
Containerization
Intro to Dockers
Dockers Installation
Docker Commands
Containerizing an App
SOFTWARE DEPLOYMENT
IN PAST
Disadvantages
Very Costly
Resource Wastage
Many Servers to manage
VIRTUALIZATION
VIRTUALIZATION
VMware in 1998….
Come with Virtualization
Multiple App on a Single Server
Different OS and dependencies on the
same server using VMs
Better than old one
Saves resources
Disadvantages
OS consume a lot of resources.
Licensing Cost of OS
CONTAINERIZATION
CONTAINERIZATION
Docker Daemon
Docker Daemon listens for API
requests and manages docker
objects such as images, network,
volumes.
DOCKER ARCHITECTURE
Containerd
Bridge between daemon and runc.
It helps in
Starting and Stopping Containers
Pausing and unpausing
Destroying containers
DOCKER ARCHITECTURE
Runc
Runc often refer as a container
runtime.
To create containers.
DOCKER ARCHITECTURE
Shim
Usedfor the implementation of
daemonless containers.
Shim makes it possible to maintain
and upgrades without impacting
running containers.
(no need to stop and kill
containers)
DOCKER INSTALLATION
INSTALLATION STEPS
Install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
DOCKER COMMANDS
docker -- version
docker info
docker version
IMAGES
DOCKER IMAGE
Image
A container image is a lightweight,
standalone, executable package of
software that includes everything
needed to run an application.
Code
Runtime
System Tools
System Libraries
Settings
Images become containers when they run
on Docker Engine.
Images are made up of multiple layers.
DOCKER IMAGE
Image
Inside of the image is A cut-down operating system (OS), and all of the files and dependencies
required to run an application.
In this way, each layer contains different things required to run a containerized app.
Common layers among different images are downloadable only once and get reuse in all images.
We build containers based on images and that is why images are sometimes called stopped
containers.
We can create images from actual stopped containers.
DOCKER IMAGE
Image
Once the container is up and running made from an image, the two constructs become
dependent on each other and you cannot delete the image until the last container using it has
been stopped and destroyed.
The purpose of container is to run an application.
However, containers are all about being fast and lightweight.
Official Ubuntu Docker image which is about 120 MB.
BUILDING IMAGE
Build Image
docker build -t first-docker-app .
Image Listing
docker image ls / docker images
Removing Image Docker File has two main purposes
docker image rm first-docker-app:latest
To describe an application
Note:
Images are used for creating containers.
To tell Docker how to containerize the
application
We cannot delete an image until the last
container using it has been stopped and
destroyed.
IMAGE REGISTRIES
Error
The push refers to repository [docker.io/usama9876/first-docker-app]
An image does not exist locally with the tag: usama9876/first-docker-app
If you do not specify an image tag after the repository name, docker
will assume that you are referring to the image tagged as latest.
RUNNING A CONTAINER
RUNNING A CONTAINER
Container
CONTAINERIZING AN APP FROM SCRATCH
Demo
FROM nginx:latest
COPY . /usr/share/nginx/html
BIND MOUNT
BIND MOUNT
Data Persistence
By using bind mount, a file or directory on the host machine mounted into a container.
BIND MOUNT
Delete this container
Now bind another container with this mounted folder on host.
HAVE A GOOD DAY!