Professional Documents
Culture Documents
(DevOps) Lecture - Docker - (For Students)
(DevOps) Lecture - Docker - (For Students)
DevOps
Lecture
Containerization
using Docker
By
Asad Hanif
Asad Hanif 1
DevOps
Declaimer
Contents of the lecture are taken from following links
https://docs.docker.com/get-started/
https://www.youtube.com/playlist?list=PLoz1vq3JRiWNZBHNOf8uGuXaYTTogQ
A0t
https://www.youtube.com/playlist?list=PL0hSJrxggIQoKLETBSmgbbvE4FO_eE
goB
https://www.youtube.com/playlist?list=PLyvfcZJ0pCaKOt1jWmsMTuGBq76EPu
kMh
https://devopscube.com/what-is-docker/
https://devopscube.com/build-docker-image/
Asad Hanif 2
1
3/31/2023
DevOps
Asad Hanif 3
DevOps
Asad Hanif 4
2
3/31/2023
DevOps
Asad Hanif 5
DevOps
Hypervisor
Virtualization allows applications to be isolated
Host Operating System
between VMs.
Hardware Infrastructure
Asad Hanif 6
3
3/31/2023
DevOps
Asad Hanif 7
DevOps
Hypervisor
Each VM is a full machine running all the
Host Operating System
components, including its own operating
Hardware Infrastructure
system, on top of the virtualized hardware.
Physical Machine / Server
Asad Hanif 8
4
3/31/2023
DevOps
Asad Hanif 9
DevOps
Asad Hanif 10
10
5
3/31/2023
DevOps
Benefits of Containers
Containers have become popular because they provide extra
benefits, such as:
Asad Hanif 11
11
DevOps
Benefits of Containers
Containers have become popular because they provide extra
benefits, such as:
4) Observability:
• Not only surfaces OS-level information and metrics, but also application
health and other signals.
Asad Hanif 12
12
6
3/31/2023
DevOps
Benefits of Containers
Containers have become popular because they provide extra
benefits, such as:
Asad Hanif 13
13
DevOps
Benefits of Containers
Containers have become popular because they provide extra
benefits, such as:
7) Application-centric management:
• Raises the level of abstraction from running an OS on virtual hardware to
running an application on an OS using logical resources.
8) Resource isolation:
• Predictable application performance.
Asad Hanif 14
14
7
3/31/2023
DevOps
Benefits of Containers
Containers have become popular because they provide extra
benefits, such as:
9) Resource utilization:
• High efficiency and Density.
15
DevOps
Asad Hanif 16
16
8
3/31/2023
DevOps
Docker Installation
Asad Hanif 17
17
DevOps
https://docs.docker.com/engine/install/ubuntu/
Asad Hanif 18
18
9
3/31/2023
DevOps
19
DevOps
Asad Hanif 20
20
10
3/31/2023
DevOps
Asad Hanif 21
21
DevOps
Asad Hanif 22
22
11
3/31/2023
DevOps
Asad Hanif 23
23
DevOps
Asad Hanif 24
24
12
3/31/2023
DevOps
Asad Hanif 25
25
DevOps
What is Docker?
Asad Hanif 26
26
13
3/31/2023
DevOps
Asad Hanif 27
27
DevOps
28
14
3/31/2023
DevOps
• The container becomes the unit for distributing and testing the application.
Asad Hanif 29
29
DevOps
Docker Architecture
Asad Hanif 30
30
15
3/31/2023
DevOps
Docker Architecture
Asad Hanif 31
31
DevOps
Docker Hands-on
Asad Hanif 32
32
16
3/31/2023
DevOps
List Containers
Show running stopped containers
$ docker ps
$ docker ps -a
Asad Hanif 33
33
DevOps
List Images
Show all top-level images, their repository and tags, and
their size
$ docker images
34
17
3/31/2023
DevOps
Pull Images
Download an image from a registry (Docker Hub)
https://docs.docker.com/engine/refer
ence/commandline/pull/
Asad Hanif 35
35
DevOps
Run Containers
Create and run a new container from an image
Example
36
18
3/31/2023
DevOps
Rename Container
To rename a container, we use following command.
https://docs.docker.com/engine/re
ference/commandline/rename/
Asad Hanif 37
37
DevOps
Remove Containers
Remove one or more containers
https://docs.docker.com/engine/refer
ence/commandline/rm/
Asad Hanif 38
38
19
3/31/2023
DevOps
Remove Images
Remove one or more images
https://docs.docker.com/engine/re
ference/commandline/rmi/
Asad Hanif 39
39
DevOps
Demo
Run Nginx in a Docker
Container
Asad Hanif 40
40
20
3/31/2023
DevOps
Asad Hanif 41
41
DevOps
$ docker rm my-nginx
Asad Hanif 42
42
21
3/31/2023
DevOps
$ mkdir -p ~/docker-nginx/html
$ cd ~/docker-nginx/html
$ nano index.html
Asad Hanif 43
43
DevOps
Asad Hanif 44
44
22
3/31/2023
DevOps
Asad Hanif 45
45
DevOps
46
23
3/31/2023
DevOps
List of Containers
We can create various independent services using different
programming languages and platforms.
Asad Hanif 47
47
DevOps
Asad Hanif 48
48
24