Skip to content

Commit

Permalink
Merge branch 'main' into I200744-Sawaira-Fatima
Browse files Browse the repository at this point in the history
  • Loading branch information
kahootali authored Nov 26, 2023
2 parents 6c30bc3 + e667304 commit 8802535
Show file tree
Hide file tree
Showing 15 changed files with 278 additions and 0 deletions.
56 changes: 56 additions & 0 deletions 19F_0257-Shah-Abdullah.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Q1) Explain Docker Containers vs VMs?

Solution:

1. Docker Containers
* They are light weight as compared to VMs.
* They use host OS kernel.
* They are more efficient in terms of resource utilization as they does not requires full OS.
* Containers are highly resource efficient and start up quickly.
* Each container has its own file sytem.
* Containers are highly portable.

2. VMs
* VMs would run on full OS stack including the kernel which makes the heavier.
* VMs are more resource intensive.
* Vms provide stronger isolation because they emulte separate hardware.
* Every VM has its own kernel and resources making it more secure and suitable for running.
* Vms are less portable as compared to conainers.

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

Solution:

docker run -d --name assignment-2-19F_0257
-p 9090:80
--network assignemnt_02
nginx:1.24.0

Q3) Run the above command and add screenshot of it and share the logs

Solution:

2023-10-04 23:37:26 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
2023-10-04 23:37:26 /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
2023-10-04 23:37:26 /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
2023-10-04 23:37:26 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
2023-10-04 23:37:26 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
2023-10-04 23:37:26 /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
2023-10-04 23:37:26 /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
2023-10-04 23:37:26 /docker-entrypoint.sh: Configuration complete; ready for start up
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: using the "epoll" event method
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: nginx/1.24.0
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: OS: Linux 5.10.102.1-microsoft-standard-WSL2
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker processes
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 29
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 30
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 31
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 32
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 33
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 34
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 35
2023-10-04 23:37:26 2023/10/04 18:37:26 [notice] 1#1: start worker process 36


8 changes: 8 additions & 0 deletions I19-1741-Hadia-Sultan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##Q1) Difference between Docker Containers vs VMs
-VMs provide hardlevel virtualization whereas containers have OS level abstraction.
-Vms share hardware but they have their own OS whereas container can/cannot have their own OS.
-Vms have complete OS and static memory whereas containers have burstable compute and burstable memory.
-Vms are very large in size i.e Gigabytes whereas containers take upto few hundred megabytes.

##Q2) Command to create a docker container in detached mode
docker run -d -p 9090:80 --name assignment-2-I19-1741 --network assignment-2 nginx:1.24.0
28 changes: 28 additions & 0 deletions I19-2157-Hammad-Umar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Q1:
A Docker Containers is an isolated environment containing an application and all of its dependencies and is a product of OS level virtualization, which shares the host OS kernel.
Virtual Machines are a product of hardware level virtualization, containing their own copy of an OS and OS kernel and emulating a complete virtualized environment.

Q2:
podman run -d -p 9090:80 -n assignment-2-I19-2157 --network assignment-2 nginx:1.24.0

Q3:
[ansible@control ~]$ podman logs assignment-2-I19-2157
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/10/07 16:54:19 [notice] 1#1: using the "epoll" event method
2023/10/07 16:54:19 [notice] 1#1: nginx/1.24.0
2023/10/07 16:54:19 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2023/10/07 16:54:19 [notice] 1#1: OS: Linux 4.18.0-477.21.1.el8_8.x86_64
2023/10/07 16:54:19 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 262144:262144
2023/10/07 16:54:19 [notice] 1#1: start worker processes
2023/10/07 16:54:19 [notice] 1#1: start worker process 29
2023/10/07 16:54:19 [notice] 1#1: start worker process 30
2023/10/07 16:54:19 [notice] 1#1: start worker process 31
2023/10/07 16:54:19 [notice] 1#1: start worker process 32

28 changes: 28 additions & 0 deletions assignment-2/I19-0444-Afsheen-Ahmad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Q1 : Explain Docker Containers vs VMs


Containers
● OS level virtualization, also known as containerization, operates at the application layer. It encapsulates both the application code and its dependencies into a self-contained unit.
● Containers share the underlying hardware resources and the host operating system kernel, but they can have their own isolated operating system environment if needed.
● Container images are relatively compact, typically ranging from tens to hundreds of megabytes in size, making them efficient in terms of storage.
● Containers offer a high degree of isolation, ensuring that the applications running within them do not interfere with each other.
● Key characteristics of containers include isolation, shared kernel, the ability to allocate burstable compute and memory resources, and efficient utilization of system resources.


VMs
● Hardware-Level Virtualization refers to the concept of abstracting or creating a virtual representation of physical computer hardware.
● Shared Hardware with Own OS, i-e multiple virtual machines (VMs) share the same physical hardware but each VM runs its own independent operating system.
● Each VM contains a complete set of components, including a full operating system, application software, binaries, and libraries.
● VMs can consume a significant amount of storage space, often requiring several gigabytes (GBs) or even tens of GBs each.
● VMs are isolated from each other, meaning that actions or issues in one VM typically do not affect other VMs running on the same hardware.
● VMs emulate complete operating systems and offer a static allocation of compute resources and memory. This can result in high resource usage, as each VM has its own dedicated allocation of these resources.




Q2 : Write command to create a docker container in detached mode with name assignment-2-<ROLL_NUMBER> running on host port 9090 and container port 80 using image nginx with version 1.24.0 on a custom network named assignment-2


Ans:

docker run -d --name assignment-2-I19-0444 -p 9090:80 nginx:1.24.0 --network assignment-2
22 changes: 22 additions & 0 deletions assignment-2/I19-2012-Abdullah-Shahzad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Abdullah Shahzad `19I-2012`
## DevOps Assignment#02

### Q1) Explain Docker Containers vs VMs
VMs are an abstraction of physical hardware turning one server into multiple servers while containers are an abstraction at the application layer that packages code and dependencies together. VMs run on a hypervisor, which is a software or hardware layer that creates and manages multiple VMs on a physical server while containers share the host OS's kernel but run in isolated user spaces.

VMs come with more overhead because each VM includes a full OS, which can consume a significant amount of resources. On the other hand, containers are lightweight because they don't need a full OS for each application as they share the host OS kernel and use resources more efficiently. VMs provide strong isolation since each VM has its own OS, and they operate independently of each other. Containers provide isolation, but it's not as strong as VMs. They share the same OS kernel, which means they are more lightweight but also more interdependent.

In a nutshell, VMs are like running multiple computers on a single physical machine, each with its own OS, while containers are like running multiple applications in lightweight, isolated environments that share the same OS kernel.

### Q2) Write command to create a docker container in `detached` mode with name `assignment-2-<ROLL_NUMBER>` running on host port `9090` and container port `80` using image `nginx` with version `1.24.0` on a custom network named `assignment-2`
First create a network name `assignment-2`
```
docker network create assignment-2
```
Now create the docker container named `assignment-2-I19-2012` on the custom network
```
docker container run -d -p 9090:80 --name assignment-2-I19-2012 --network assignment-2 nginx:1.24.0
```

### Q3) Run the above command and add screenshot of it and share the logs
<img src="container-info.png" alt="my container info" />
31 changes: 31 additions & 0 deletions assignment-2/I19-2192-Zaka-Ullah.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Answer 1:
Docker Containers:
1. Docker Containers are lighweight & efficent.
2. They share kernel with Host OS.
3. Docker Containers offer process level isolation.
4. They offer burstable compute.
5. Docker comes with all the required dependencies & configuration files.
6. Alot of pre-build images are available on docker hub.

VMs:
1. Resource intensive as compared to docker containers.
2. Each VM has its own OS.
3. VM offers static compute of resources.
4. VMs can provide strong isolation at OS level.
5. Deploying an app from developers machine to a VM can be a problem as there can be configuration problems.


Answer 2:
docker run -d --name assignment-2-I19-2192 -p 9090:80 --network assignment-2 nginx:1.24.0


Answer 3:
The command execution & the logs for the docker container are shown in the below picture.
![docker run](https:/kahootali/first-contributions/assets/86046697/870b4dc0-300b-46c1-96d0-720722f61717)

In the below image, we can see that on port 9090, nginx is running.
![port 9090](https:/kahootali/first-contributions/assets/86046697/09e4b2b6-a03b-4e27-bd5f-dfd9eb1b5a81)




45 changes: 45 additions & 0 deletions assignment-2/I20-0488-Amna-Salahudin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Q1) Explain Docker Containers vs VMs

1. **Architecture:**
- **Docker Containers:**
- OS level virtualization, i.e. abstraction at the application layer which includes the code and the dependencies.
- Shares the hardware, host OS kernel but can have its own OS.
- Containers are isolated and the applications as well.
- **Virtual Machines:**
- Shares hardware of the Host OS but has its own operating system.
- VMs are isolated but the applications are not.

2. **Resource Efficiency:**
- **Docker Containers:**
- Takes up less space (typically tens to hundreds of MBs in size) and starts almost instantly.
- Has burstable compute, burstable memory and low resource usage.
- **Virtual Machines:**
- Each VM includes a full copy of the operating system, one or more apps, necessary binaries and libraries - taking up tens of GBs.
- VMs can also be slow to boot.
- Has static compute, static memory and high resource usage.

3. **Security:**
- **Docker Containers:**
- Have potential security risks if not properly managed, as a vulnerability in the host OS could potentially impact all containers running on it.
- **Virtual Machines:**
- Provide a more secure boundary, as each VM is completely isolated from the host and other VMs.

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

**Answer:**
```bash
docker run -d --name assignment-2-I20-0488 --network assignment-2 -p 9090:80 nginx:1.24.0
```

### Q3) Run the above command and add screenshot of it and share the logs

<a href="https://imgur.com/zDcGUSA"><img src="https://i.imgur.com/zDcGUSA.png" title="source: imgur.com" /></a>


<a href="https://imgur.com/IZpfTLt"><img src="https://i.imgur.com/IZpfTLt.png" title="source: imgur.com" /></a>

**Logs:**
<a href="https://imgur.com/J6OCrqx"><img src="https://i.imgur.com/J6OCrqx.png" title="source: imgur.com" /></a>



Binary file added assignment-2/container-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions assignment-2/i180689-Armughan_noor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Q1 : Explain Docker Containers vs VMs


Containers
● Operating System-level virtualization, commonly referred to as containerization, functions at the application layer. It bundles both the application code and its prerequisites into a self-contained entity.
● Containers utilize the underlying hardware resources and the host operating system kernel, with the option for an isolated operating system environment if necessary.
● Container images are notably compact, typically ranging in size from tens to hundreds of megabytes, contributing to their efficiency in terms of storage.
● Containers deliver a robust level of isolation, guaranteeing that the applications housed within them do not disrupt one another.
● Key attributes of containers encompass isolation, shared kernel, the capacity to allocate burstable computing and memory resources, and efficient utilization of system resources.


VMs
● Hardware-Level Virtualization involves the abstraction or creation of a virtual representation of physical computer hardware.
● In this setup, multiple virtual machines (VMs) share the same physical hardware but operate independently with their own operating systems.
● Each VM consists of a comprehensive set of components, encompassing a full operating system, application software, binaries, and libraries.
● VMs can consume a substantial amount of storage space, often necessitating several gigabytes (GBs) or even tens of GBs each.
● VMs are isolated from one another, ensuring that actions or problems within one VM typically have no impact on other VMs running on the same hardware.
● VMs mimic complete operating systems and provide a fixed allocation of computing resources and memory. This can lead to high resource consumption since each VM has its dedicated resource allocation.




Q2 : Write command to create a docker container in detached mode with name assignment-2-<ROLL_NUMBER> running on host port 9090 and container port 80 using image nginx with version 1.24.0 on a custom network named assignment-2


Ans:

docker run -d --name assignment-2-I18-0689 -p 9090:80 nginx:1.24.0 --network assignment-2
Binary file added assignment-2/screentshots/create-network.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assignment-2/screentshots/pull-image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assignment-2/screentshots/run-container.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assignment-2/screentshots/show-logs.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions first-contribution
Submodule first-contribution added at 67db8a
31 changes: 31 additions & 0 deletions i20-0538-Areeba-Asif.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Q1) Explain Docker Containers vs VMs:

Docker Containers and Virtual Machines (VMs) are both technologies used
for running applications in isolated environments, but they operate differently:

Docker Containers:

Containers are lightweight and share the host OS kernel.
They package an application and its dependencies together.
Containers start quickly and use fewer resources.
Ideal for microservices architecture and scaling applications.

VMs (Virtual Machines):

VMs are more like running a full operating system.
They run multiple applications on top of a hypervisor.
VMs are slower to start and use more resources.
Suitable for running different OS types and legacy applications.

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

docker run -d --name assignment-2-i20-0538 -p 9090:80 --network assignment-2 nginx:1.24.0

![Screenshot](https://imgur.com/a/gsopNEa)





0 comments on commit 8802535

Please sign in to comment.