Docker Introduction
Docker Introduction
Jeeva S. Chelladhurai
[email protected]
1
What is Virtualization
Source: http://en.wikipedia.org/wiki/Virtualization
2
Types of Hypervisor
• Bare-metal
• Hosted
Bare-Metal Hosted
3
Virtualization
4
Virtualization
5
Virtualization
6
Virtualization!!!
Why? Why?? Why???
7
• Space
• Electricity
• Cooling
• Cabling
8
Benefits of Virtualization
9
Benefits of
Virtualization
10
Benefits of
Virtualization
11
Containers!!!
What heck it is???
12
15
16
Container-Based Virtualization
17
Docker: What?
18
Docker: Why?
19
Docker: Architecture
Source: https://docs.docker.com/engine/introduction/understanding-docker
20
Docker Architecture
Docker Host
• Client-Server
• Same or Remote
• Socket or RESTful API
• Docker Engine aka
Container 1
Container 2
Container 3
Container 4
Container 5
• Daemon or Server Docker
Client
• Inside Docker
• Image Docker
• Container Engine
• Registry Linux Kernel
21
Type 2 hypervisor vs. Containers
Host OS Host OS
Hardware Hardware
22
Type 1 hypervisor vs. Containers
Hardware Hardware
23
Docker: Nuts & Bolts
24
Anatomy of Docker Engine
25
Instructions for hands-on activity
26
Install Docker on Ubuntu
27
Install Docker on CentOS
29
Docker for Win/Mac
30
Understand the Docker Setup
31
Docker: Image
• Read-only Layer
• Union File System
• Base Image
• Parent Image
• Image ID
- 64 hexadecimal digit
- Internally 256bit value
- Short ID: 12 hex digit
• Stateless
32
Working with Docker Images
33
Docker Hub
34
Docker: Container
35
Working with Docker Containers
• Interactive Container
$ sudo docker run -i -t ubuntu:16.04 /bin/bash
root@742718c21816:/# hostname
742718c21816
root@742718c21816:/# id
uid=0(root) gid=0(root) groups=0(root)
root@742718c21816:/# echo $PS1
${debian_chroot:+($debian_chroot)}\u@\h:\w\$
root@742718c21816:/#
Ctrl-p + Ctrl-q.
36
Working with Docker Containers
37
Container Life-Cycle
Source: http://docker-saigon.github.io/post/Docker-Internals/
38
Working with Docker Containers
• Controlling containers
$ sudo docker stop <container name or id>
$ sudo docker start <container name or id>
$ sudo docker restart <container name or id>
$ sudo docker pause <container name or id>
$ sudo docker unpause <container name or id>
39
Hands on Activity: HTTP Service (1/2)
40
Hands on Activity: HTTP Service (2/2)
41
Comparing your changes
42
Creating your own Docker Image
43
Inspect
44
A few more docker run options
45
Docker Network
• Default
• Bridge
• Host
• Null
• Advanced
• Overlay
• MacVLAN, IPVLAN
46
Default Bridge – docker0
47
Hands On
48
Filtering the IP address
49
Container Networking Model
Docker Host
Container Container
lo eth0 lo eth0
veth veth
docker0
eth0
LAN
50
- net none / host
51
Exposing the Containers
52
Sharing Host Data
53
Dockerfile
$ cat Dockerfile
# Base image is Ubuntu
FROM ubuntu:16.04
EXPOSE 80
54
Container as a Service
55
Dockerfile Instructions
• FROM • EXPOSE
• MAINTAINER • LABEL
• COPY • RUN
• ADD • CMD
• ENV • ENTRYPOINT
• ARG • HEALTHCHECK
• USER • STOPSIGNAL
• WORKDIR • ONBUILD
• VOLUME • SHELL
56
Linking Container
57
User-defined Bridge
58
Thank You!