Docker in Real Life
Presented by Nguyen Van Vuong
Framgia - Div 3 - Group 4
Index
● What is Docker?
● What problems does Docker solve?
● Understanding Docker
● Docker Image/Volumes
● Docker Registry
● ↢ Practice ↣
● Docker Network
● Native Clustering
● Docker Compose
● ↢ Practice ↣
● References
2
Welcome to Docker
3
What is Docker?
- A platform that allows you to “build, ship, and
run any app, anywhere.”
- Docker is
- A command-line program
- A background daemon
- Set of remote services
It accomplishes this using a UNIX technology
called containers.
4
What is Docker?
- History of Docker
Author: Solomon Hykes
Released: March 2013
Main contributors:
❖ The Docker team
❖ Cisco, Huawei, Red Hat
❖ Google, IBM, Microsoft
5
What is Docker?
- Docker is a container engine
6
What is Docker?
- Software delivery before and after Docker
7
What is Docker?
- Software delivery before and after Docker
8
What is Docker?
- Docker vs Virtual Machine
9
What is Docker?
“Everything at Google, from Search to Gmail,
is packaged and run in a Linux container.”
Eric Brewer, VP of Google Infrastructure
10
What is Docker?
- Docker Survey, 2016 (1)
11
What is Docker?
- Docker Survey, 2016 (2)
12
What is Docker?
- Docker Survey, 2016 (3)
13
What is Docker?
- Docker Survey, 2016 (4)
14
What problems does Docker solve?
- What happens:
- One application needs an upgraded
dependency but the other does not?
- You remove an application? Is it really gone?
- Can you remove old dependencies?
- Can you remember all the changes you had to
make to install the software you now want to
remove?
15
What problems does Docker solve?
- Dependency relationships of example program
- Programs running inside containers with copies of their
dependencies
16
What problems does Docker solve?
- Quickly experiment with software
Docker can give you a sandbox environment in milliseconds
17
What problems does Docker solve?
- Improving portability
18
What problems does Docker solve?
- Protecting your machine
19
vs
What problems does Docker solve?
- CI/CD: Every change is automatically deployed
20
What problems does Docker solve?
“Each week we launch more than 2 billion container
instances across our global data centers, ... ”
Eric Brewer, VP of Google Infrastructure
21
“At Instagram, we deploy our backend code 30–50 times a
day… whenever engineers commit changes to master… with no
human involvement in most cases.”
Michael Gorven, Production Engineer at Facebook
Understanding Docker
22
Understanding Docker
- Overview of Docker architecture
23
Understanding Docker
- Overview of Docker architecture
- The Docker daemon is the hub of your interactions with
Docker
- Try to curl post/get unix-socket
24
Understanding Docker
- Docker running containers on a basic Linux
computer system
25
Understanding Docker
- Docker key concepts
26
Understanding Docker
- Container state and dependencies
27
Understanding Docker
- Isolated environments (containers)
- PID namespace
- UTS namespace
- MNT namespace
- IPC namespace
- NET namespace
- USR namespace
- chroot()
- cgroups
28
Docker Image/Volumes
- Image and Container
29
Docker Image/Volumes
- Ways to create a new Docker image
- Docker command “By Hand”
- Create a new image with docker commit
- Dockerfile
- Text file with a series of commands
- Dockerfile and configuration management (CM) tool
- Building images with Chef Solo/Ansible
- Scratch image and import a set of files
- Converting your VM to a container
30
Docker Image/Volumes
- Writing a Dockerfile
- A Dockerfile is a text file with a series of commands in it
- Docker Instructions
31
Docker Image/Volumes
- What is Volumes
- A volume is a mount point on the container’s directory
tree where a portion of the host directory tree has been
mounted.
32
Docker Image/Volumes
- Volumes provide container-independent data
management
- Create modularity for architectural components.
- Inject behavior into containers without modifying an
image.
33
Docker Image/Volumes
- Volume types
- Bind mount volume
- Managed volume
- Volume can be sharing between containers
34
Docker Registry
- Once you’ve created your images, you may want
to share them with other users.
35
Docker Registry
- Docker registry
- Private network
- Public network
- Allow
- Multiple users to push
and pull images from
a central store using a
RESTful API.
- Open source
- https://github.com/docker/distribution
36
Docker Registry
- Repository
37
Docker Registry
- Docker Hub
- A registry maintained by Docker, Inc
- Tens of thousands of images ready to download and run
- Free for public repositories (images)
- Paid for private repositories (images)
38
Docker Registry
- Docker Hub
- https://hub.docker.com
- Automated build
- Support Webhook
39
Docker Registry
- Gitlab Container Registry
40
Docker Registry
- Quay.io Registry
41
Time for action
42
Docker Network
- Docker container networking
- Single-host
- Multi-host
43
The local Docker network topology
Docker Network
- Networks on single-host
- bridge (default)
- none
- host
44
Docker Network
- Exposing and publishing ports
- Exposing ports is a way of documenting which ports are
used, but does not actually map or open any ports
- Publishing port tells Docker which ports to open on the
container’s network interface and mapped to an available
port on the host machine
- Links
- Allow a container to resolve another container’s name to
an IP address
45
Native Clustering
- What is a node?
- An instance of the Docker engine participating in the
swarm
- Types of node
- Manager node
- Worker node
- Services and tasks
- Replicated services
- Global services
- Load balancing
46
Native Clustering
- Docker swarm
47
Native Clustering
- RancherOS
48
Native Clustering
- CoreOS - Tectonic
49
Docker Compose
- Monolithic vs Microservices Architecture
50
Docker Compose
- Microservices
- Deployability
- Reliability
- Availability
- Scalability
- Modifiability
- Management
- Design autonomy
51
Docker Compose
- Docker Compose
- A tool for defining and running multi-container Docker
applications
- Great for development, testing, and staging environments
- 3 steps to use Docker Compose
- Define your app’s environment with a Dockerfile
- Define the services in docker-compose.yml
- Run docker-compose up
52
Docker Compose
- Get started
- Build application count the number of hits the site
- Python/Flask + Redis
53
Docker Compose
- Scaling out our app
- Swarm mode
54
Time for action
55
References
- https://github.com/euclid1990/docker-in-real-life
- https://docs.docker.com
- https://engineering.instagram.com/continuous-deployment-at-instagram-1e18548f0
1d1
- https://cloudplatform.googleblog.com/2014/06/an-update-on-container-support-on
-google-cloud-platform.html
- http://www.informationweek.com/cloud/infrastructure-as-a-service/google-docker-
does-containers-right/d/d-id/1319146
- http://www.vermasachin.com/posts/7-running-docker-mac
- https://sreeninet.wordpress.com/2015/05/31/docker-swarm
- https://www.slideshare.net/ramitsurana/introducing-docker-swarm-the-orchestrati
on-tool-by-docker
- https://docs.gitlab.com/ce/administration/container_registry.html
- https://www.penflip.com/akira.ohio/appcatalyst-hands-on-lab-en
56
References
57
Thank for listening
58

Docker in real life

  • 1.
    Docker in RealLife Presented by Nguyen Van Vuong Framgia - Div 3 - Group 4
  • 2.
    Index ● What isDocker? ● What problems does Docker solve? ● Understanding Docker ● Docker Image/Volumes ● Docker Registry ● ↢ Practice ↣ ● Docker Network ● Native Clustering ● Docker Compose ● ↢ Practice ↣ ● References 2
  • 3.
  • 4.
    What is Docker? -A platform that allows you to “build, ship, and run any app, anywhere.” - Docker is - A command-line program - A background daemon - Set of remote services It accomplishes this using a UNIX technology called containers. 4
  • 5.
    What is Docker? -History of Docker Author: Solomon Hykes Released: March 2013 Main contributors: ❖ The Docker team ❖ Cisco, Huawei, Red Hat ❖ Google, IBM, Microsoft 5
  • 6.
    What is Docker? -Docker is a container engine 6
  • 7.
    What is Docker? -Software delivery before and after Docker 7
  • 8.
    What is Docker? -Software delivery before and after Docker 8
  • 9.
    What is Docker? -Docker vs Virtual Machine 9
  • 10.
    What is Docker? “Everythingat Google, from Search to Gmail, is packaged and run in a Linux container.” Eric Brewer, VP of Google Infrastructure 10
  • 11.
    What is Docker? -Docker Survey, 2016 (1) 11
  • 12.
    What is Docker? -Docker Survey, 2016 (2) 12
  • 13.
    What is Docker? -Docker Survey, 2016 (3) 13
  • 14.
    What is Docker? -Docker Survey, 2016 (4) 14
  • 15.
    What problems doesDocker solve? - What happens: - One application needs an upgraded dependency but the other does not? - You remove an application? Is it really gone? - Can you remove old dependencies? - Can you remember all the changes you had to make to install the software you now want to remove? 15
  • 16.
    What problems doesDocker solve? - Dependency relationships of example program - Programs running inside containers with copies of their dependencies 16
  • 17.
    What problems doesDocker solve? - Quickly experiment with software Docker can give you a sandbox environment in milliseconds 17
  • 18.
    What problems doesDocker solve? - Improving portability 18
  • 19.
    What problems doesDocker solve? - Protecting your machine 19 vs
  • 20.
    What problems doesDocker solve? - CI/CD: Every change is automatically deployed 20
  • 21.
    What problems doesDocker solve? “Each week we launch more than 2 billion container instances across our global data centers, ... ” Eric Brewer, VP of Google Infrastructure 21 “At Instagram, we deploy our backend code 30–50 times a day… whenever engineers commit changes to master… with no human involvement in most cases.” Michael Gorven, Production Engineer at Facebook
  • 22.
  • 23.
    Understanding Docker - Overviewof Docker architecture 23
  • 24.
    Understanding Docker - Overviewof Docker architecture - The Docker daemon is the hub of your interactions with Docker - Try to curl post/get unix-socket 24
  • 25.
    Understanding Docker - Dockerrunning containers on a basic Linux computer system 25
  • 26.
  • 27.
    Understanding Docker - Containerstate and dependencies 27
  • 28.
    Understanding Docker - Isolatedenvironments (containers) - PID namespace - UTS namespace - MNT namespace - IPC namespace - NET namespace - USR namespace - chroot() - cgroups 28
  • 29.
  • 30.
    Docker Image/Volumes - Waysto create a new Docker image - Docker command “By Hand” - Create a new image with docker commit - Dockerfile - Text file with a series of commands - Dockerfile and configuration management (CM) tool - Building images with Chef Solo/Ansible - Scratch image and import a set of files - Converting your VM to a container 30
  • 31.
    Docker Image/Volumes - Writinga Dockerfile - A Dockerfile is a text file with a series of commands in it - Docker Instructions 31
  • 32.
    Docker Image/Volumes - Whatis Volumes - A volume is a mount point on the container’s directory tree where a portion of the host directory tree has been mounted. 32
  • 33.
    Docker Image/Volumes - Volumesprovide container-independent data management - Create modularity for architectural components. - Inject behavior into containers without modifying an image. 33
  • 34.
    Docker Image/Volumes - Volumetypes - Bind mount volume - Managed volume - Volume can be sharing between containers 34
  • 35.
    Docker Registry - Onceyou’ve created your images, you may want to share them with other users. 35
  • 36.
    Docker Registry - Dockerregistry - Private network - Public network - Allow - Multiple users to push and pull images from a central store using a RESTful API. - Open source - https://github.com/docker/distribution 36
  • 37.
  • 38.
    Docker Registry - DockerHub - A registry maintained by Docker, Inc - Tens of thousands of images ready to download and run - Free for public repositories (images) - Paid for private repositories (images) 38
  • 39.
    Docker Registry - DockerHub - https://hub.docker.com - Automated build - Support Webhook 39
  • 40.
    Docker Registry - GitlabContainer Registry 40
  • 41.
  • 42.
  • 43.
    Docker Network - Dockercontainer networking - Single-host - Multi-host 43 The local Docker network topology
  • 44.
    Docker Network - Networkson single-host - bridge (default) - none - host 44
  • 45.
    Docker Network - Exposingand publishing ports - Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports - Publishing port tells Docker which ports to open on the container’s network interface and mapped to an available port on the host machine - Links - Allow a container to resolve another container’s name to an IP address 45
  • 46.
    Native Clustering - Whatis a node? - An instance of the Docker engine participating in the swarm - Types of node - Manager node - Worker node - Services and tasks - Replicated services - Global services - Load balancing 46
  • 47.
  • 48.
  • 49.
  • 50.
    Docker Compose - Monolithicvs Microservices Architecture 50
  • 51.
    Docker Compose - Microservices -Deployability - Reliability - Availability - Scalability - Modifiability - Management - Design autonomy 51
  • 52.
    Docker Compose - DockerCompose - A tool for defining and running multi-container Docker applications - Great for development, testing, and staging environments - 3 steps to use Docker Compose - Define your app’s environment with a Dockerfile - Define the services in docker-compose.yml - Run docker-compose up 52
  • 53.
    Docker Compose - Getstarted - Build application count the number of hits the site - Python/Flask + Redis 53
  • 54.
    Docker Compose - Scalingout our app - Swarm mode 54
  • 55.
  • 56.
    References - https://github.com/euclid1990/docker-in-real-life - https://docs.docker.com -https://engineering.instagram.com/continuous-deployment-at-instagram-1e18548f0 1d1 - https://cloudplatform.googleblog.com/2014/06/an-update-on-container-support-on -google-cloud-platform.html - http://www.informationweek.com/cloud/infrastructure-as-a-service/google-docker- does-containers-right/d/d-id/1319146 - http://www.vermasachin.com/posts/7-running-docker-mac - https://sreeninet.wordpress.com/2015/05/31/docker-swarm - https://www.slideshare.net/ramitsurana/introducing-docker-swarm-the-orchestrati on-tool-by-docker - https://docs.gitlab.com/ce/administration/container_registry.html - https://www.penflip.com/akira.ohio/appcatalyst-hands-on-lab-en 56
  • 57.
  • 58.