0% found this document useful (0 votes)
2 views3 pages

Week 12 Lecture (2)

Containerization is a lightweight and efficient alternative to virtual machines, allowing for portable, scalable, and isolated applications, with Docker being a popular platform for managing containers. The document outlines key Docker concepts, installation steps, and basic commands for running and building containers, as well as networking and storage options within Docker. It emphasizes the benefits of using containers in virtualized environments, including resource efficiency and ease of scaling services.

Uploaded by

jannatimtiaz288
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Week 12 Lecture (2)

Containerization is a lightweight and efficient alternative to virtual machines, allowing for portable, scalable, and isolated applications, with Docker being a popular platform for managing containers. The document outlines key Docker concepts, installation steps, and basic commands for running and building containers, as well as networking and storage options within Docker. It emphasizes the benefits of using containers in virtualized environments, including resource efficiency and ease of scaling services.

Uploaded by

jannatimtiaz288
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Containerization & Docker in Virtualized

Environments

2. Introduction to Containerization
What is Containerization?

Lightweight, portable, and scalable alternative to Virtual Machines (VMs).


Containers share the host OS kernel, reducing overhead.
Popular container runtime: Docker, Podman, LXC.

Benefits of Containerization

Portability – Run applications anywhere.


Efficiency – Uses fewer resources than VMs.
Scalability – Easily scale services in cloud environments.
Isolation – Secure and self-contained applications.

3. Introduction to Docker
What is Docker?

Open-source containerization platform for building, running, and managing containers.


Uses Docker Engine to manage lightweight, isolated applications.
Supports Docker Hub, a public repository for container images.

Key Docker Concepts

• Images – Pre-configured environments (e.g., Ubuntu, Nginx).


• Containers – Running instances of Docker images.
• Dockerfile – Script to automate image creation.
• Volumes – Persistent storage for containers.
• Networking – Connects containers internally and externally.

4. Lab Activity: Installing Docker & Running Containers


Step 1: Install Docker on Linux

Update the system:

sudo apt update && sudo apt upgrade -y

Install Docker:

sudo apt install docker.io -y

Enable and start Docker:

sudo systemctl enable --now docker

Verify installation:

docker --version

Step 2: Run a Simple Docker Container

Pull an Ubuntu image:

docker pull ubuntu

Run a container from the image:

docker run -it ubuntu /bin/bash

Verify running containers:

docker ps

Step 3: Build a Custom Docker Image

Create a Dockerfile:

FROM ubuntu
RUN apt update && apt install -y nginx
CMD ["nginx", "-g", "daemon off;"]

Build the Docker image:

docker build -t my-nginx .

Run the custom container:


docker run -d -p 8080:80 my-nginx

Test the container:

curl http://localhost:8080

5. Docker Networking and Storage


1. Networking in Docker

Bridge Network – Default network, allows communication between containers.


Host Network – Directly connects to the host’s network.
Overlay Network – Used in Docker Swarm for multi-host networking.

List networks:

docker network ls

Create a new network:

docker network create my_network

Run a container on the new network:

docker run -d --name my_app --network my_network nginx

2. Docker Volumes (Persistent Storage)

Volumes allow containers to store and share data.


Used when data needs to persist beyond the container’s lifecycle.

Create a volume:

docker volume create my_volume

Attach the volume to a container:

docker run -d -v my_volume:/data nginx

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy