0% found this document useful (0 votes)
5 views6 pages

Practical 11: Container

The document provides an overview of containerization and Docker architecture for application deployment, highlighting the benefits of using containers over virtual machines. It outlines the steps to install Docker, run containers, and manage images, along with basic Docker commands. Additionally, it discusses Docker's client-server architecture, advantages, and challenges associated with containerization.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Practical 11: Container

The document provides an overview of containerization and Docker architecture for application deployment, highlighting the benefits of using containers over virtual machines. It outlines the steps to install Docker, run containers, and manage images, along with basic Docker commands. Additionally, it discusses Docker's client-server architecture, advantages, and challenges associated with containerization.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practical 11

Practical Title:
To understand containerization concepts and Docker architecture for application
deployment

Theory:

1. What is Containerization?
Containerization is a lightweight virtualization technique where applications and their
dependencies are packaged together into a single unit called a container. Instead of
installing software separately on different systems (and praying it works), containers
ensure the application runs consistently across environments.

2. What is Docker?
Docker is an open-source platform used to create, manage, and run containers.

It provides tools to:

 Build container images

 Run containers

 Share containers via registries

3. Difference between Virtual Machine and Container:

Feature Virtual Machine Container

Architecture Runs on hypervisor Runs on host OS

OS Each VM has full OS Shares host OS

Size Heavy (GBs) Lightweight (MBs)

Startup Time Slow Fast

Performance Less efficient More efficient

Isolation Strong Moderate


4. Docker Architecture:

Docker uses a client-server architecture. The Docker client communicates with the Docker
daemon (the server), which handles the heavy lifting of building, running, and distributing
your containers.

Procedure:

Step 1: Install Docker and verify installation


docker --version

Step 2: Pull a Docker Image


docker pull nginx

Step 3: Run a Container


docker run -d -p 8080:80 nginx

Step 4: Check Running Containers


docker ps

Step 5: Stop Container


docker stop <container_id>

Step 6: Remove Container


docker rm <container_id>

Step 7: Remove Image


docker rmi nginx
Output Screenshots:

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Step 6:
Step 7:

Task:

Task 1:
Run a Docker container and access it through browser.
Run: docker run -d -p 8081:80 nginx

Open browser and go to: [Link]

Task 2:
List basic Docker commands used.

 docker --version → Displays the installed Docker version


 docker pull <image> → Downloads an image from Docker Hub to your system
 docker run → Creates and starts a container from an image
 docker ps → Lists all running containers
 docker stop → Stops a running container
 docker rm → Deletes a stopped container
 docker rmi → Removes a Docker image from the system
Task 3:
Explain Docker architecture with diagram.

Docker follows a client-server architecture that enables efficient containerized application


deployment.

1. Docker Client

The Docker Client is the primary interface through which users interact with Docker. It allows
users to execute commands such as:

 docker build – to create images

 docker pull – to download images from a registry

 docker run – to create and start containers

The client communicates with the Docker Daemon using REST APIs.

2. Docker Host (Docker Engine)

The Docker Host contains the Docker Daemon, which is responsible for managing core Docker
objects, including:

 Images – Read-only templates used to create containers (e.g., Ubuntu, Nginx)

 Containers – Executable instances of images that run applications in isolated


environments

The daemon handles image building, container execution, networking, and storage.

3. Docker Registry

A Docker Registry is a centralized repository used to store and distribute Docker images.

 Public registries like Docker Hub provide pre-built images (e.g., Ubuntu, Nginx)
 Users can also push custom images to registries for reuse and deployment

4. Workflow

The interaction between components follows this flow:

1. The client sends commands to the Docker Daemon

2. The daemon pulls images from the registry if not available locally

3. Images are used to create and run containers on the host

Advantages

1. Portability
Applications run consistently across different environments (development, testing,
production) without compatibility issues.

2. Lightweight and Efficient


Containers share the host OS kernel, making them faster and more resource- efficient
compared to virtual machines.

3. Scalability
Docker enables easy scaling of applications by creating multiple container instances as
needed.

4. Faster Deployment
Pre-built images allow rapid application deployment, reducing setup and configuration
time.

5. Isolation
Each container operates independently, ensuring that applications do not interfere
with each other.

Challenges

1. Security Concerns
Since containers share the host OS kernel, vulnerabilities can potentially affect multiple
containers.

2. Complexity in Large Systems


Managing multiple containers and services requires orchestration tools like
Kubernetes, increasing system complexity.

3. Persistent Storage Management


Containers are ephemeral by nature, making data persistence and storage management
more challenging.

You might also like