Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 2 - I190729 - MUHAMMAD-HAMZA #184

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions I19-0729-MUHAMMAD-HAMZA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Assignment 2 - I19-0729 - MUHAMMAD-HAMZA

## Q1) Explain Docker Containers vs VMs

Docker containers and virtual machines (VMs) serve similar purposes, but they differ in their architectural approach and resource usage:

### Docker Containers:
- Containers are lightweight and share the host OS's kernel, which makes them highly efficient in terms of resource usage.
- They use a layered file system (images) and package all dependencies with the application, ensuring consistency across environments.
- Containers can start and stop quickly, making them suitable for microservices architecture and scaling applications.
- Docker uses a Dockerfile to define the container's configuration and dependencies.

### Virtual Machines (VMs):
- VMs are more heavyweight as they include a full OS stack, which consumes more resources.
- Each VM runs its own OS, leading to greater isolation but higher resource overhead.
- VMs typically take longer to start and stop compared to containers.
- Virtualization software, such as VMware or VirtualBox, manages VMs.

In summary, Docker containers are lightweight, share the host OS, and are highly portable, making them a preferred choice for modern applications. VMs, on the other hand, provide stronger isolation but come with higher resource overhead.

## Q2) Write command to create a docker container in detached mode with name assignment-2-I19-01729 running on host port 9090 and container port 80 using image nginx with version 1.24.0 on a custom network named assignment-2

To create a Docker container with the specified parameters, use the following command:

```bash
docker run -d --name assignment-2-I19-0729 -p 9090:80 --network assignment-2 nginx:1.24.0