Docker in Real Life Presented by Nguyen Van Vuong Framgia - Div 3 - Group 4
Index 2 ● What is Docker? ● What problems does Docker solve? ● Understanding Docker ● Docker Image/Volumes ● Docker Registry ● ↢ Practice ↣ ● Docker Network ● Native Clustering ● Docker Compose ● ↢ Practice ↣ ● References
Welcome to Docker 3
What is Docker? 4 - 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.
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? 10 “Everything at Google, from Search to Gmail, is packaged and run in a Linux container.” Eric Brewer, VP of Google Infrastructure
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? 15 - 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?
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 vs 19
What problems does Docker solve? - CI/CD: Every change is automatically deployed 20
What problems does Docker solve? 21 “Each week we launch more than 2 billion container instances across our global data centers, ... ” Eric Brewer, VP of Google Infrastructure “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 28 - Isolated environments (containers) - PID namespace - UTS namespace - MNT namespace - IPC namespace - NET namespace - USR namespace - chroot() - cgroups
Docker Image/Volumes - Image and Container 29
Docker Image/Volumes 30 - 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
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 33 - Volumes provide container-independent data management - Create modularity for architectural components. - Inject behavior into containers without modifying an image.
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 The local Docker network topology 43
Docker Network - Networks on single-host - bridge (default) - none - host 44
Docker Network 45 - 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
Native Clustering 46 - 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
Native Clustering - Docker swarm 47
Native Clustering - RancherOS 48
Native Clustering - CoreOS - Tectonic 49
Docker Compose - Monolithic vs Microservices Architecture 50
Docker Compose 51 - Microservices Ɯ - Deployability - Reliability - Availability - Scalability - Modifiability - Management - Design autonomy
Docker Compose 52 - 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
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 56 - 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
References 57
Thank for listening 58

Guide to Learn docker in Real Life with Example