Download - Dockerize it all
![Page 1: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/1.jpg)
www.tothenew.com
Dockerize it all
![Page 2: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/2.jpg)
www.tothenew.com
About Me
Puneet BehlAssociate Technical LeadTO THE NEW [email protected]: https://github.com/puneetbehl/Twitter: @puneetbhlLinkedIn: https://in.linkedin.com/in/puneetbhl
![Page 3: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/3.jpg)
www.tothenew.com
Agenda
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello world demo● Running Stack of services using Docker Compose● Moving to Production
![Page 4: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/4.jpg)
www.tothenew.com
Agenda
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello world demo● Running Stack of services using Docker Compose● Moving to Production
![Page 5: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/5.jpg)
www.tothenew.com
Let’s see how things can get complicated with shipping code??
![Page 6: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/6.jpg)
www.tothenew.com
A simple web application with one developer
A Developer
![Page 7: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/7.jpg)
www.tothenew.com
Added more developers to team
Multiple Developers
![Page 8: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/8.jpg)
www.tothenew.com
Setup QA & Production Environment
Multiple Developers
QA ServerPublic Cloud
Production Clusters
![Page 9: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/9.jpg)
www.tothenew.com
Created Background Workers
Multiple Developers
QA ServerPublic Cloud
Production Clusters
![Page 10: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/10.jpg)
www.tothenew.com
Refactored, Microservice Architecture
Multiple Developers
QA ServerPublic Cloud
Production Clusters
![Page 11: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/11.jpg)
www.tothenew.com
● “Works on my machine” syndrome● Hard disk crashed -> New Setup -> Nothing Works :(● Adding new Developer in the team● Going live? Please DO NOT break on production.● Dependency Hell - Common dependency with different
versions
In Nutshell, what are the challenges?
![Page 12: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/12.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Understanding Docker components & architecture.● Installation● Hello World demo● Running Stack of services using Docker Compose● Moving to Production
![Page 13: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/13.jpg)
www.tothenew.com
The Solution
Multiple Developers
QA ServerPublic Cloud
Production Clusters
![Page 14: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/14.jpg)
www.tothenew.com
The Solution, Contd...
Multiple Developers
QA ServerPublic Cloud
Production Clusters
![Page 15: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/15.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello World demo● Running Stack of services using Docker Compose● Moving to Production
![Page 16: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/16.jpg)
www.tothenew.com
A Docker Container allows application developer to package up their application with all it’s dependencies they are associated with.
What is Docker Container?
![Page 17: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/17.jpg)
www.tothenew.com
Okay! I understand Docker Containers now, they are like VM???
![Page 18: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/18.jpg)
www.tothenew.com
Okay! I understand Docker Containers now, they are like VM???
![Page 19: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/19.jpg)
www.tothenew.com
Hmmm…
![Page 20: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/20.jpg)
www.tothenew.com
Let’s see what is the difference between application running on VM v/s Docker?
![Page 21: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/21.jpg)
www.tothenew.com
Application Running On VM v/s Container
![Page 22: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/22.jpg)
www.tothenew.com
Application Running On Docker Container
![Page 23: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/23.jpg)
www.tothenew.com
Application Running On VM v/s Container
![Page 24: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/24.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello World demo● Running Stack of services using Docker Compose● Moving to Production
![Page 25: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/25.jpg)
www.tothenew.com
● Scalability - The containers are extremely lightweight so scaling up and scaling down is very easy.
Benefits of using Docker
![Page 26: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/26.jpg)
www.tothenew.com
● Scalability - The containers are extremely lightweight so scaling up and scaling down is very easy.
● Portability - just pull the image and start container.
Benefits of using Docker
![Page 27: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/27.jpg)
www.tothenew.com
● Scalability - The containers are extremely lightweight so scaling up and scaling down is very easy.
● Portability - just pull the image and start container.● Deployment - because containers can run almost anywhere
we can deploy to Desktop, Physical Server, Virtual Machine, Public/Private Cloud etc.
Benefits of using Docker
![Page 28: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/28.jpg)
www.tothenew.com
● Scalability - The containers are extremely lightweight so scaling up and scaling down is very easy.
● Portability - just pull the image and start container.● Deployment - because containers can run almost anywhere
we can deploy to Desktop, Physical Server, Virtual Machine, Public/Private Cloud etc.
● Efficient Resource Utilization - Multiple isolated containers sharing resources.
Benefits of using Docker
![Page 29: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/29.jpg)
www.tothenew.com
Why Developers Care?
![Page 30: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/30.jpg)
www.tothenew.com
● Build any application in any language using any stack.● Dockerize application can run anywhere on anything.● No longer need to cross our fingers when we deploy to
production● Helps improving application design
Why Developers Care?
![Page 31: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/31.jpg)
www.tothenew.com
Why Devops Care?
![Page 32: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/32.jpg)
www.tothenew.com
● Easy migrations to different infrastructure● Replication of different environments is very easy.● Fix an issue once, it’s fixed everywhere ● Less conflicts with developers, because of same
environment.
Why Devops Care?
![Page 33: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/33.jpg)
www.tothenew.com
Why Business Care?
![Page 34: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/34.jpg)
www.tothenew.com
● Boost Productivity
Why Business Care?
![Page 35: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/35.jpg)
www.tothenew.com
● Boost Productivity● Reduce Risk
Why Business Care?
![Page 36: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/36.jpg)
www.tothenew.com
● Boost Productivity● Reduce Risk● Reduce Cost
Why Business Care?
![Page 37: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/37.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello World demo...● Running Stack of services using Docker Compose● Moving to Production
![Page 38: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/38.jpg)
www.tothenew.com
Docker Core Components
● Docker Daemon
![Page 39: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/39.jpg)
www.tothenew.com
Docker Core Components
● Docker DaemonThe Docker daemon runs on a host machine. The user does not directly interact with the daemon, but instead through the Docker client.
![Page 40: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/40.jpg)
www.tothenew.com
Docker Core Components
● Docker Daemon
● Docker Client
![Page 41: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/41.jpg)
www.tothenew.com
Docker Core Components
● Docker Daemon
● Docker ClientThe Docker client, in the form of the docker binary, is the primary user interface to Docker. It accepts commands from the user and communicates back and forth with a Docker daemon.
![Page 42: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/42.jpg)
www.tothenew.com
Docker Workflow Components
![Page 43: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/43.jpg)
www.tothenew.com
Docker Workflow Components
● Docker ImageA Docker image is a read-only template to build Docker Containers
![Page 44: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/44.jpg)
www.tothenew.com
Docker Workflow Components
● Docker ImageA Docker image is a read-only template to build Docker Containers
● Docker RegistriesDocker registries hold images. These are public or private stores from where you upload or download images.
![Page 45: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/45.jpg)
www.tothenew.com
Docker Workflow Components
● Docker ImageA Docker image is a read-only template to build Docker Containers
● Docker ContainerCreated from images. start, stop, run
● Docker RegistriesDocker registries hold images. These are public or private stores from where you upload or download images.
![Page 46: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/46.jpg)
www.tothenew.com
Docker Architecture
![Page 47: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/47.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello World demo● Running Stack of services using Docker Compose● Moving to Production
![Page 48: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/48.jpg)
www.tothenew.com
Installation
● Linux Follow steps for your version of linux https://docs.docker.com/engine/installation/
apt-get install docker-engine
yum install docker-engine
● Mac or Windows OS Use docker toolbox isntaller : https://www.docker.com/docker-toolbox
![Page 49: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/49.jpg)
www.tothenew.com
Installations : Docker toolbox
![Page 50: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/50.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello world demo● Running Stack of services using Docker Compose● Moving to Production
![Page 51: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/51.jpg)
www.tothenew.com
A Spring Boot application
$ ( spring jar hello.jar hello.groovy ) && ( java -jar hello.jar )
![Page 52: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/52.jpg)
www.tothenew.com
Build Image Using Dockerfile
FROM java:8
MAINTAINER Puneet Behl "[email protected]"
ADD hello.jar /app/hello.jar
EXPOSE 8080
CMD ["java", "-jar", "/app/hello.jar"]
![Page 54: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/54.jpg)
www.tothenew.com
Contents
● Understanding the problem of shipping code● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello world demo● Running stack of services using Docker compose● Moving to Production
![Page 55: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/55.jpg)
www.tothenew.com
A Complicated application architecture
![Page 56: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/56.jpg)
www.tothenew.com
Docker Compose
frontend: image: pbehl/frontend ports: - "3000:3000" links: - backend environment: backendServerUrl: "http://backend:8080" command: "node server.js"
mongodb: image: mongobackend: image: pbehl/backend links: - mongodb environment: "spring.data.mongodb.host": "mongodb" "logging.level.org.springframework.web": "DEBUG" ports: - "8080:8080"
![Page 58: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/58.jpg)
www.tothenew.com
Contents
● Understand the problem● The solution● What is Docker Container?● Benefits of Docker● Understanding Docker components & architecture.● Installation● Hello world demo● Running Stack of services using Docker Compose● Moving to Production
![Page 59: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/59.jpg)
www.tothenew.com
Orchestration tools needed for docker cluster environment● Provision servers● Deploy● Manage servers
Some of the available orchestration tools● Docker swarm● Centurion● Amazon EC2 container service
Moving to Production
![Page 60: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/60.jpg)
www.tothenew.com
Questions???
![Page 61: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/61.jpg)
www.tothenew.com
Thank you
![Page 62: Dockerize it all](https://reader035.vdocuments.us/reader035/viewer/2022062401/58eecaa91a28abe30d8b466d/html5/thumbnails/62.jpg)
www.tothenew.com
Sample Demo: https://github.com/puneetbehl/gr8conf-docker-demoDocker documentation: https://docs.docker.comDocker tool-box https://www.docker.com/docker-toolboxDocker hub: https://hub.docker.com/Docker up and running from O'Reilly publication Authors: Karl Matthias & Sean P. KaneUnion file system : https://en.wikipedia.org/wiki/UnionFShttp://stackoverflow.com/questions/16047306/how-is-docker-different-from-a-normal-virtual-machineBuild and push images to docker hub https://youtu.be/QCEWQs6LwAkDocker-compose https://youtu.be/kn_dUA6f29I
References