Docker Presentation
Docker Presentation
Feb, 2019
Agenda
• What is Docker?
• Containers vs. VMs
• How Docker works
• Why Dockers ? Docker Benefits
• Why Developers Care ?
• Docker Architecture
• What are Docker Images
• What are Docker Containers
• How to run Tomcat on Docker Container
• What is Docker File
• What is Docker Compose
• What is Docker Volumes
• Docker Swarm
Docker: Containerization for Software
3
Virtual Machine
Container
VM vs. Docker (Containers)
Docker Engine
Docker engine is the layer on
which Docker runs.
It’s a lightweight runtime and
tooling that manages
containers, builds, and more.
6
Why are Docker containers lightweight?
VMs Containers
App
App Δ
App App App
App
A’ A A’
A A
Bins/
Bins/
Bins/ Bins/ Bins/ Bins/
Libs Libs Libs Libs Libs 2
Guest
Guest Guest OS
Guest
OS OS OS
Original App Copy of Modified App
(No OS to take App
up space, resources, No OS. Can Copy on write
or require restart) Share bins/libs capabilities allow
us to only save the diffs
VMs Between container A
Every app, every copy of an and container
app, and every slight modification A’
of the app requires a new virtual server
So why Docker?
• Ease of use. It allows anyone to package an application on their laptop, which in turn
can run unmodified anywhere
• The mantra is: “build once, run anywhere.”
• Speed. Docker containers are very lightweight and fast. Since containers are just
sandboxed environments running on the kernel, they take up fewer resources. You can
create and run a Docker container in seconds, compared to VMs which might take
longer because they have to boot up a full virtual operating system every time.
• Docker Hub. Docker users also benefit from the increasingly rich ecosystem of Docker
Hub, which you can think of as an “app store for Docker images.” Docker Hub has tens
of thousands of public images created by the community that are readily available for
use.
• Modularity and Scalability. Docker makes it easy to break out your application’s
functionality into individual containers. With Docker, it’s become easier to link
containers together to create your application, making it easy to scale or update
components independently in the future.
Docker Benefits
9
Why Developers Care
Push
Container A
Docker
Container
Image
Registry
Search
Pull
Build Run
Dockerfile
For
A
Container B
Container A
Container C
Docker
Source
Code
Docker Engine
Repository
Host 1 OS (Linux)
Host 2 OS (Linux)
Changes and Updates
App Push
App Δ
A
Docker
Bins/ Container
Bins/
Libs Image
Registry
App Δ
Container Mod A’ Mod A’’
Update
Image
Bins/
App App
A’’ A
Bins/ Bins/
Bins/
Libs Libs
COMMANDS :
:docker build
:docker build -t ImageName:Tag directoryOfDocekrfile
:docker run image
What is Docker Compose
• Tool for defining & running multi-container docker applications.
• Use yaml files to configure application services (docker-compose.yml)
• Can start all services with a single command : docker compose up
• Can stop all services with a single command : docker compose down
• Can scale up selected services when required
What is Docker Volumes
• Volumes are stored in a part of the host filesystem which is managed by Docker.
• Non-Docker processes should not modify this part of the filesystem
• Bind mounts may be stored anywhere on the host system
• A given volume can be mounted into multiple containers simultaneously.
• Use of Volumes
Decoupling container from storage
Share volume (storage/data) among different containers
Attach volume to container
On deleting container, volume is not deleted
Docker Swarm
• A swarm is a group of machines that are running Docker and joined into a cluster.
• Docker Swarm is a tool for Container Orchestration.
• Let’s take an example You have 100 containers
• You need to do
Health check on every container
Ensure all containers are up on every system
Scaling the containers up or down depending on the load
Adding updates/changes to all the containers
• Orchestration - managing and controlling multiple docker containers as a single service
• Tools available - Docker Swarm, Kubernetes, Apache Mesos
Want to learn more?
• www.docker.io:
• Documentation
• Getting started: interactive tutorial, installation instructions, getting started guide,
• About: Introductory whitepaper: http://www.docker.io/the-whole-story/
• Github: dotcloud/docker
• IRC: freenode/#docker
• Google groups: groups.google.com/forum/#!forum/docker-user
• Twitter: follow @docker
www.docker.io