6.76M
Category: industryindustry

Docker and Containers

1.

2.

3.

Docker and Containers
Containers and containerization technologies such as Docker and
Kubernetes have received an overwhelming appreciation and massive popularity in recent years.
Containers offer an improved method to package distributed applications, deploy them in a consistent manner,
and run them in isolation from one another on the same or different virtual or physical server(s).

4.

Why do you need
docker?
• Compatibility/Dependen
cy
• Long setup time
• Different
Dev/Test/Prod
environments
Web
Server
Databas
e
Messagin
g
Orchestratio
n
The Matrix from Hell
!!
Librarie
s
Dependenci
es
OS
Hardware
Infrastructure

5.

What can itdo?
• Containeriz
e
Application
s
• Run each service with
its own dependencies
in separate containers
Containe
r
Web
Server
Containe
r
Databas
e
Lib
s
Lib
s
Dep
s
Containe
r
Messagin
g
Dep
Lib
s
s
Docker
?
Dep
s
OS
Hardware Infrastructure
Containe
r
Orchestratio
n
Lib
s
Dep
s

6.

A container is essentially a set of processes that runs in complete seclusion on a Linux system
A single Linux system running on bare metal hardware or in a virtual machine may have tens or hundreds
of containers running; The underlying hardware may be located either on the ground or in the cloud.
Applications encapsulated to run inside containers are called containerized applications, and this is a
growing trend for architecting and deploying applications, application components, and databases in real
world environments.

7.

8.

9.

10.

11.

12.

13.

d
o
c k e r
Getting
Starte
d

14.

15.

16.

docke
r
co m m an ds

17.

18.

19.

20.

21.

22.

23.

24.

25.

docker run ubuntu
docker ps
CONTAINER ID
I MAGE
COMMAND
CREATED
STATUS
PORTS
IMAGE
ubuntu
COMMAND
"/bin/bash"
CREATED
43 seconds ago
STATUS
E xi t e d ( 0 ) 41 seconds ago
docker ps - a
CONTAINER ID
45aacca36850
PORTS

26.

27.

28.

29.

d o ck er
run

30.

31.

32.

Run – PORT mapping
docker run kodekloud/webapp
http://192.168.1.5:80
* Running on h t t p : / / 0 . 0 . 0 . 0 : 5 0 0 0 / (Press CTRL+C t o q u i t )
80
8000
8001
IP: 192.168.1.5
http://172.17.0.2:5000
docker run –p 80:5000 kodeklou d/ simpl e- webapp
docker run –p 8000:5000 kodekloud/simple-webapp
Internal IP
3
3
0
6
docker run –p 8001:5000 kodekloud/simple-webapp
docker run –p 3306:3306 mysql
docker run –p 8306:3306 mysql
docker run –p 8306:3306 mysql
8
3
0
6
5000
5000
5000
IP: 172.17.0.2
IP: 172.17.0.3
IP: 172.17.0.4
Web APP
Web APP
Web APP
Docker Container
Docker Container
Docker Container
3 IP: 172.17.0.5
3 MySQL
0
Docker
6 Container
3 IP: 172.17.0.6
3 MySQL
0
Docker
6 Contain
3 IP: 172.17.0.6
3 MySQL
0
Docker
6 Contain
er
Docker Host
er

33.

RUN – Volume mapping
docker run mysql
docker stop mysql
docker rm mysql
Data
docker run –v / o p t / d a t a d i r : / v a r / l i b / m y s q l mysql
/var/lib/mysql
/opt/datadir
MYSQL
Docker Container
Docker Host
English     Русский Rules