cover photo

COURSEWORK

Rimshan's CL-CY-001 course work. Lv 2

RimshanAUTHORACTIVE
work cover photo
This Report is yet to be approved by a Coordinator.

7 / 6 / 2026


Task 2: Docker Basics and Container Management

1. Understanding Docker and Containers

Docker is a containerization platform that allows applications to run in isolated environments called containers.

Important concepts learned:

  • Docker Image: Template used to create containers.
  • Docker Container: Running instance of an image.
  • Docker Hub: Repository for Docker images.
  • Docker CLI: Command-line tool used to manage Docker resources.

Containers vs Virtual Machines

  • Containers are lightweight and share the host operating system.
  • Virtual Machines include a complete operating system and require more resources.
  • Containers start faster and consume less memory.

2. Pulling and Running a Docker Image

Downloaded the Nginx image from Docker Hub:

docker pull nginx

Started a container from the image:

docker run -d -p 8080:80 nginx

Image download and Running conatainer Nginx server


3. Viewing Containers and Logs

Checked running containers:

docker ps

Viewed all containers, including stopped containers:

docker ps -a

Viewed container logs:

docker logs 

Container list and logs


4. Inspecting and Managing Containers

Inspected container details:

docker inspect 

Stopped and restarted the container:

docker stop 
docker restart 

Removed the container:

docker rm 

5. Managing Docker Images

Listed available images:

docker images

Removed an unused image:

docker rmi 

Outcome

Successfully learned Docker fundamentals, understood the difference between Containers and Virtual Machines, pulled images from Docker Hub, created and managed containers, viewed logs and container details, listed images, and performed complete container lifecycle management using Docker CLI commands.

Task 3: Containerizing a Notes Application Using Docker

1. Understanding Docker and Containerization

Docker is a containerization platform that allows developers to package applications along with their dependencies into portable containers. Containers ensure that applications run consistently across different environments without requiring additional configuration.

Important components used in this task:

  • Dockerfile: A text file containing instructions to build a Docker image.
  • Docker Image: A packaged blueprint containing the application and its dependencies.
  • Docker Container: A running instance of a Docker image.
  • Port Mapping: Allows access to services running inside a container from the host machine.
  • Image Layers: Each Dockerfile instruction creates a separate layer that Docker can cache and reuse.

  1. Creating the Notes Application

A simple Notes Application was developed using Node.js and Express.

Features implemented:

Add new notes. View saved notes. Delete existing notes. Store notes in a local JSON file.

Project structure:

notes-app/ │ ├── public/ │ ├── index.html │ ├── style.css │ └── script.js │ ├── notes.json ├── server.js ├── package.json └── Dockerfile

The application was configured to run on Port 3000 and successfully served both the frontend and backend functionality. Note App


3. Writing the Dockerfile

A Dockerfile was created to define the environment required for the application.

Example Dockerfile:

FROM node:20

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["node", "server.js"]

Dockerfile instructions used:

  • FROM– Selects the base Node.js image.

  • WORKDIR – Sets the working directory inside the container.

  • COPY – Copies project files into the container.

  • RUN – Installs required dependencies.

  • EXPOSE – Documents the application port.

  • CMD – Starts the application when the container runs.

4. Building the Docker Image

The Docker image was built using the following command:

docker build -t notes-app .

Docker successfully processed the Dockerfile instructions and created the application image.

The image was verified using:

docker images

Docker Image's Image Docker Image


5. Running the Docker Container

A container was launched from the created image using:

docker run -d -p 3001:3000 --name notes-container notes-app

Explanation:

  • -d runs the container in detached mode.
  • -p 3001:3000 maps host port 3001 to container port 3000.
  • --name assigns a name to the container.

The running container was verified using:

docker ps

Running Docker Container Image. Running Docker container


6. Accessing the Application

The Notes Application was accessed through a web browser using:

http://localhost:3001

The application loaded successfully and all note management features were tested.

Verified operations:

Adding notes. Viewing notes. Deleting notes.

The frontend communicated successfully with the Node.js and Express backend, and notes were stored and retrieved from the local JSON file.

Notes Application running in browser on Port 3001. Note app

7. Understanding Docker Image Layers

Each instruction in the Dockerfile creates a separate image layer.

Example:

FROM node:20

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

CMD ["node", "server.js"]

Generated layers:

Base Node.js image. Working directory creation. Package file copy. Dependency installation. Application source code copy. Application startup command.

Docker caches unchanged layers, which speeds up future image builds.

Docker build output showing image layers. Image Layer


Outcome

Successfully containerized a Notes Application using Docker by creating a Dockerfile, building a Docker image, running the application inside a container, mapping container ports to the host machine, and accessing the application through a web browser. Additionally, gained practical understanding of Docker images, containers, port mapping, and image layers.

Task 4: Launch and Manage an AWS EC2 Instance

1. Understanding EC2

Amazon EC2 (Elastic Compute Cloud) is a cloud computing service provided by AWS that allows users to create and manage virtual machines on the cloud. These virtual machines can host applications, websites, and services that are accessible over the internet.

Important components used in this task:

  • AMI (Amazon Machine Image): Contains the operating system required to launch an EC2 instance. I used Ubuntu Server 24.04 LTS.
  • Instance Type: Determines CPU and memory allocation. I selected a t3.micro instance.
  • Security Group: Acts as a firewall and controls inbound and outbound traffic.
  • Key Pair: Used for secure authentication while connecting through SSH.

2. Launching the EC2 Instance

  • Opened the AWS EC2 dashboard.
  • Launched a new Ubuntu EC2 instance.
  • Selected the t3.micro instance type.
  • Created and downloaded a .pem key pair.
  • Successfully launched the EC2 instance.

EC2 instance in Running state. EC2 instance in Running state

3. Connecting to the EC2 Instance

  • Connected to the EC2 instance using SSH from Windows PowerShell.
  • Authenticated using the downloaded .pem key.
  • Verified successful login to the Ubuntu server.

This provided command-line access to the cloud server.

Successful SSH connection showing the Ubuntu terminal. SSH Connection


4. Installing and Starting Nginx

Installed the Nginx web server using the following commands:

sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl status nginx

The Nginx service started successfully and was verified using the status command.

Nginx status showing "active (running)". Nginx Status


5. Configuring Security Group Rules

Initially, the Nginx page was not accessible because HTTP traffic was blocked.

To resolve this:

  • Opened the Security Group attached to the EC2 instance.
  • Added an inbound rule for HTTP.
  • Allowed traffic on Port 80 from Anywhere (0.0.0.0/0).

This enabled public access to the web server.

Security Group inbound rules showing SSH and HTTP. Security Group


6. Verifying the Web Server

Opened the EC2 public IP address in a web browser:

http://98.130.124.189

The default Nginx welcome page was displayed successfully, confirming that the web server was running and accessible from the internet.

Nginx Welcome Page.  Nginx Welcome Page


Outcome

Successfully launched and managed an AWS EC2 instance, connected through SSH, installed Nginx, configured Security Groups, and hosted a web server accessible through the public IP address.

UVCE,
K. R Circle,
Bengaluru 01