SlideShare una empresa de Scribd logo
1 de 51
State of the Art in Microservices
Microservices architecture and docker
Alexander Ivanichev
November 2015
AGENDA
• Evolution of Software Architecture
• Docker concepts
• Creating docker hosts with docker-machine
• Running docker
• Running an Application Server in Docker
• Image vs. Container
• Changing container behaviour
• 3 ways to deploy an application
• How to link multiple containers
• Introduction to microservices
EVOLUTION OF SOFTWARE
ARCHITECTURE
Methodology
Process
Patterns
Platform
Waterfall Agile Lean Engineering
Continuous Delivery
Microservice Architecture
Cloud
Scrum
3-Tier Layered
Windows / Linux
Gated
2-Tier Monolithic
Windows
Device Any DeviceBrowserDesktop
MARKET EVOLUTION
Thick, client – server app
On thick client
1995
Well-defined stack:
• O/S
• Runtime
• Middleware
Monolithic
Physical
Infrastructure
2015
Thick, app on
any device
Assembled by
developers using best
available services
Running on any available
set of physical resources
Microservices
WHAT IS A SERVICE?
The service is peace of software which provides functionality to other peace's of software.
Service provides functionality to application for example:
Service that provides CRUD orders from database , communicated over network.
DB
Service
Website
Mobile app
Desktop app
APP
WHAT IS MICROSERVICE ?
An architecture of designing a software in a set of independent services
loosely coupled via lightweight communication.
Recommenda
tion Service
(MongoDB)
Rating
Service
(Neo4j)
Analysis
Service
(Spark)
Movie Service
(MySQL)
User Service
(MySQL)
Discovery
Service
• Application that is spilt into small pieces(suite of small services)
• Each service built around business capabilities (1 piece = 1 responsibility) and independently deployable
• Each service running in its own process
• loosely coupled : Inter-process communication mechanism, e.g. HTTP, Message Queue
• Bare minimum centralized management service
• Each service can be in different programming language and use different data storage technologies
Microservice formal definition:
Loosely coupled service oriented
architecture with bounded contexts
If every service has to be
updated at the same time it’s
not loosely coupled
Microservice formal definition
Loosely coupled service oriented architecture
with bounded contexts
If every service has to be updated
at the same time it’s not loosely
coupled
A Microservice formal definition
Loosely coupled service oriented architecture
with bounded contexts
If you have to know too much about surrounding services you don’t
have a bounded context. See the Domain Driven Design book by
Eric Evans.
WE HAVE SOA , WHY DOING A
MICROSERVICES
SOA problems:
• How to size a service - traditional resulted in monolithic services
• Service failure – takes all application offline
• Scale specific part of a service
Why Microservices:
• Efficiently scalable applications
• Flexible applications
• High performance applications
SOA VS MICROSERVICES
Microservices are the kind of SOA we have been talking about for the last decade. Microservices
must be independently deployable, whereas SOA services are often implemented in deployment
monoliths. Classic SOA is more platform driven, so microservices offer more choices in all
dimensions.
SOA is an architectural pattern in which application components provide services
to other components. However, in SOA those components can belong to the same
application. On the other hand, in microservices these components are suites of
independently deployable services.
SOA THE MONOLITHIC
Accounts
Products
Inventory
Promotions
Internet
Shopping
website
Orders
Internal
Support
website
Data
Access
Service DB
Customer
• No restriction on size
• Longer development times
• Inaccessible features
• High levels of coupling
• Scaling requires duplication of the
whole
• Minor change could result in
complete rebuild
MICROSERVICES
SYSTEM EXAMPLE
Accounts
Service
Products
Service
Inventory
Service
Promotions
Service
Account Orders
BasketOffers
APIGateway
Internet
Client
Shopping
website
Orders
Service
Internal
Support
website
WHY MICROSERVICES
• Need to respond to change quickly
• Need for reliability
• Business domain-driven design
• Automated test tools
• Release and deployment tools
• On-demand hosting technology
• On-line cloud services
• Need to embrace new technology
• Asynchronous communication technology
• Simpler server side and client side technology
• Shorter development times
• Reliable and faster deployment
• Enables frequent updates
• Decouple the changeable parts
• Security
• Increased uptime
• Fast issue resolution
• Highly scalable and better performance
• Better ownership and knowledge
• Right technology
• Enables distributed teams
MICROSERVICES
DESIGN PRINCIPLES
High Cohesion
Single thing done well
Single focus
Approach:
Keeps splitting service until it only has
one reason to change
Autonomous
Independently changeable
Independently deployable
Approach:
Loosely coupled system, versioning strategy,
microservice ownership by team
Business Domain Centric
Represent business function or
represent a business domain
Approach:
Business domain specific
Subgroup into functions and areas
Resilience
Embrace Failure
Default or degrade functionality
Approach:
Design for known failures
Fail fast and recover fast
Observable
See system health
Centralized logging and monitoring
Approach:
Tools for real-time centralized
monitoring and centralized logging
Automation
Tools for testing and feedback
Tools for deployment
Approach:
Continuous integration tools
Continuous deployment tools
MICROSERVICES
COMMUNICATION
Synchronous vs Asynchronous
SYNCHRONOUS
COMMUNICATION
Remote procedure call (RPC)
• Sensitive to change
HTTP
• Work across the internet
• Firewall friendly
REST
• CRUD using HTTP verbs
• Natural decoupling
• Open communication protocol
• REST with HATEOS
Service One ServiceTwo
http://Service/Account/23
HTTP Verbs:
POST
PUT
GET
DELETE
JSON/XML
1. Make call
2. Wait…
3. Response received
Synchronous issues
• Both parties have to be available
• Performance subject to network quality
• Clients must know location of service (hostport)
ASYNCHRONOUS
COMMUNICATION
Event based
• Mitigates the need of client and service availability
• Decouples client and service
Message queueing protocol
• Message Brokers
• Subscriber and publisher are decoupled
• Microsoft message queuing (MSMQ)
• RabbitMQ
• ATOM (HTTP to propagate events)
Asynchronous challenge
• Complicated
• Reliance on message broker
• Visibility of the transaction
• Managing the messaging queue
Real world systems
• Would use both synchronous and asynchronous
Accounts
Service
Products
Service
Inventory
Service
Promotions
Service
API
Gateway
Internet
Client
Shopping
website
Orders
Service
Internal
Support
website
Message
Broker
API GATEWAY
• Request routing
• Bundling multiple calls (Composition)
• Protocol translation
• Authentication
• Caching
• Versioning
• Monitoring
• Load balancing
API Gateway is a server that is the single entry point into the system. The API Gateway
encapsulates the internal system architecture and provides an API that is tailored to each
client.
.NET STACK TOOLS FOR
MICROSERVICES
CI/ CD
TeamCity
Docker
Testing
xUnit.net
NUnit
Moq
FsCheck
Communication
REST
Protocol Buffers
RabbitMQ
Particular
MassTransit
Persistence
MongoDB
RavenDB
MySQL
Cassandra
Redis*
Memcached*
Logging and monitoring
Serilog
Seq
StatsD
Graphite
Grafana
Cabot - monitor and alert
Technology freedom, use the best tools available.
Demo
Docker
WHAT IS DOCKER?
“ DOCKER IS AN OPEN PLATFORM FOR BUILDING, SHIPPING
AND RUNNING DISTRIBUTED APPLICATIONS.
docker.io
Docker engine Docker Hub
APPLICATION DEPLOYMENT
HISTORY
MY APP
+
A REAL SERVER
=
But wait just a moment !
Shouldn't it be all about applications?
Best practice is:
Server application
1 : 1
WHAT IF WE WANT RUN
MULTIPLE APPS?
[1] [2] [3] [4]
…………...…….…..
[10]
[+] [+] [+] [+]
100%
50%
15%
10GB disk space
4GB RAM
5% CPU
100GB disk space
40GB RAM
50% CPU
x 10 =
DOCKER VS VM
App A
Bins/Libs
Guest OS
App A
Bins/Libs
Guest OS
Hypervisor
Host OS
Server Infrastructure
Virtual Machine
• REUSABLE IMAGES
• SNAPSHOTS
• SIMPLIFY CLUSTERS CREATION
Problems?
YES!!
"TOO HEAVY"
App A
Bins/Libs
App A
Bins/Libs
Docker Engine
Host OS
Server Infrastructure
Docker
WHAT IS A CONTAINER?
Host OS
Server Infrastructure
Physical Machine
APP
User
Space
APP
User
Space
APP
User
Space
/
dev var proc
sda sda1 lib
/
dev etc lib
sda sda1 systemd
proc
udev
/
dev etc lib
sda sda1 systemd
proc
udev
Container 1
(mnt namespace 1)
Container 2
(mnt namespace2)
Docker Engine
Containers
Container ~ VM but lightweight
HOW CONTAINERS WORK?
Physical or Virtual Server
Docker Engine
libcontainer LXC
Host OS
Namespaces cgroups Capabilities
Linux Kernel
LXC = "LINUX CONTAINERS"
OS-LEVEL VIRTUALIZATION FOR RUNNING
MULTIPLE ISOLATED LINUX SYSTEMS
CGROUPS = "CONTROL GROUPS"
LINUX KERNEL FEATURE THAT LIMITS AND ISOLATES
THE RESOURCE USAGE
(CPU, DISK I/O, NETWORK, ETC.)
AUFS= "ADV. MULTI LAYERED
UNIFICATION FS"
FILESYSTEM WHICH IS BASED ON IMAGES
WHERE EVERY MODIFICATION IS A DIFF FROM
THE PREVIOUS ONE (LIKE COMMITS IN GIT)
HOW TO INSTALL ?
Linux:
$ wget -qO- https://get.docker.com/ | sh
Mac OSX:
https://github.com/docker/toolbox/releases/download/v1.9.1c/DockerToolbox-
1.9.1c.pkg
Windows:
https://github.com/docker/toolbox/releases/download/v1.9.1c/DockerToolbox-
1.9.1c.exe
http://docs.docker.com/engine/installation/
To use docker it's necessary a linux machine.
But.. for Windows and Mac OS X there are some tools to run docker in these OS
with a Virtual Machine”.
DOCKER HUB
“The Docker Hub is a cloud-based registry service for building and
shipping application or service containers”
5.6M
Pulls per Day
240K
Repositories on
Docker Hub
65
Pulls per Second
https://hub.docker.com/
DOCKER ARCHITECTURE
Docker client
docker search
docker run
docker start
docker pull
Local / Remote
Docker daemon
Container 1
Container 2
Host OS
…
DOCKER CLIENT
• binds to daemon via unix socket
• can access if user is in docker group
can
• bind to TCP or other UNIX socket
DOCKER DAEMON
• runs as root user
• creates UNIX socket for client
Demo time! #1
Docker hello world
Docker
Client
docker run hello-world
Docker
Host
docker run <image x>
Image 1
Image 2
Image 3
Docker
Hub
Container 1
Container 2
Image 1
Image 2
Image 3
DOCKER DEMO
OVERVIEW
Daemon
DOCKER BASICS
To show all docker commands just run docker binary
docker
Get command help
docker pull --help
Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Pull an image or a repository from a registry
-a, --all-tags=false Download all tagged images in the repository
--disable-content-trust=true Skip image verification
--help=false Print usage
DOCKER BASICS
To show installed docker version
docker -v
Download a docker Ubuntu image
docker pull ubuntu
Interact with a container
docker run -it ubuntu bash
Show containers
docker ps
Show container run history
docker ps -a
HOW DOES IT
WORK?
Image RegistryContainer
Build DistributeDeploy
DOCKER IMAGES
Docker images are the basis of containers.
Previously we’ve used Docker images that already exist, for example the ubuntu image.
• Immutable templates
• Used to create containers
• Used to create other images
• Images built in layers
• Uses union filesystems to glue layers together
• Layer are cached when build
• Can be uploaded to registry
docker images # To view all images available
docker run --rm -ti somecontainer bash
Basic images commands:
• Built from instructions in Dockerfile
• Built FROM base image
• Each instruction in Dockerfile creates new layer
DOCKER LAYERS
• AUFS - AnotherUnionFS/advanced multi layered unification filesystem
• Each layer has its own hash
• Layer can be tagged
• Layers are shared
docker images --tree
2 WAYS TO CREATE
DOCKER IMAGES
1.COMMIT WAY
docker commit -m "<menssage>" <image name>
docker history <image name>
2.DOCKERFILE WAY
docker build -t <tag> <dockerfile path>
DOCKERFILE REFERENCE
FROM
MAINTAINER
WORKDIR
ENV
RUN
COPY
ADD
EXPOSE
VOLUME
USER
CMD
Dockerfile example:
And then we can build it
docker build -t somecontainer somecontainer/
FROM ubuntu
RUN apt-get update && apt-get install -y 
python 
telnet
ENTRYPOINT ["/bin/bash"]
IMAGES COMMANDS
// Build new image based on Dockerfile
> docker build -t neueda/myimage:tag ./path/to/Dockerfile
// List containers (-a to print also intermediate layers)
> docker images
// Create container based on ubuntu image, create pseudo-TTY, run command in interactive mode
> docker run -t -i ubuntu:14.04 rm -rf /etc
// Create new image based on mutations made by container
> docker commit -m "Removed /etc directory" -a "Nikolajs Arhipovs" $CONTAINER neueda/ubuntu
// Add tag to untagged image
> docker tag 5db5f8471261 neueda/ubuntu:broken
// Push to repository (Docker Hub)
> docker push neueda/ubuntu:broken
// Remove image with all intermediate layers on host
> docker rmi neueda/ubuntu:broken
Example commands
Demo time! #2
Building custom
image
DOCKER CONTAINER
• Built on top of image
• Adds RW layer using union fs
Launch
(build-time) (runtime)
Image
Container
511136ea3c5a (rootfs)
6170bb7b0ad1
9cd978db300e
87026dcb0044
coreos/apache
Metadata
Image layering
3) 87026dcb0044
2) 9cd978db300e
1) 6170bb7b0ad1
0) 511136ea3c5a
etc…..
Docker Image
One per
container
Can be
shared by
many
containers
Thin writable layer
CONTAINERS COMMANDS
Example commands
// List containers (-a to print also stopped containers)
> docker ps
// Show stdout of a container (works as `cat`)
> docker logs $CONTAINER_ID
// Attaches to currently running container (like `tail -f`), same as `docker logs -f` > docker attach $CONTAINER_ID
// Stop running containers
> docker stop $CONTAINER_ID1 $CONTAINER_ID2
// Start stopped containers
> docker start $CONTAINER_ID
// Show running processes
> docker top $CONTAINER_ID
// Show all docker-related meta info like net interfaces, port forwarding, volumes
> docker inspect $CONTAINER_ID
DOCKER REGISTRY
• Images can be pushed to registry
• Images can pulled from it
• Images can be built on FROM other images
pulled from repository
~ $ docker push -h
Usage: docker push NAME[:TAG]
Push an image or a repository to the registry
--disable-content-trust=true Skip image signing
~ $ docker push alexiv/hello
The push refers to a repository [alexiv/hello] (len: 1)
b88f9422f14d: Image push failed
Please login prior to push:
Username: alexiv
Password:
Email: alexiv@gmail.com WARNING: login credentials saved in /Users/alex/.dockercfg. Login
Succeeded The push refers to a repository [alexiv/hello] (len: 1)
b88f9422f14d: Image already exists 91e54dfb1179:
Image successfully pushed d74508fb6632:
Image successfully pushed c22013c84729:
Image successfully pushed d3a1f33e8a5a:
Image successfully pushed
Digest: sha256:d659f9011eab6d04b3d9fd9f6324e23505bd1299c52d295c4b04ebe3e58878ce ~ $
Publish image to registry:
Demo time! #3
Publishing custom
to HUB
DOCKER VOLUME
A data volume is a specially-designated directory
within one or more containers that bypasses
the Union File System.
~ $ ls /Users/baptou/myDirectory file1 file2 file3
~ $ docker run -it -v /Users/baptou/myDirectory:/opt ubuntu:latest /bin/bash
root@29088b02f260:/# ls /opt
file1 file2 file3
root@29088b02f260:/# rm /opt/file2
root@29088b02f260:/# ls /opt file1 file3
root@29088b02f260:/# exit
exit
~ $ ls /Users/baptou/myDirectory file1 file3
~ $
DOCKER KITEMATIC
Run containers through a simple, yet powerful graphical user
interface.
DOCKER FOR
WINDOWS / .NET STACK
• Visual Studio 2015 Tools for Docker
• Docker Toolbox
• Windows server 2016
DOCKER NEXT
STEPS
Tutum
Build, deploy, and
manage your apps
across any cloud
Docker Universal Control
On-premises management solution
for Docker apps - regardless of
where they run
Docker Swarm
Docker Swarm is
native clustering for
Docker.
Kubernetes
Manage a cluster of
Linux containers as a
single system
THANK YOU!

Más contenido relacionado

La actualidad más candente

Microservices architecture
Microservices architectureMicroservices architecture
Microservices architectureAbdelghani Azri
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAditya Konarde
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
Microservices
MicroservicesMicroservices
MicroservicesSmartBear
 
From Monolithic to Microservices
From Monolithic to Microservices From Monolithic to Microservices
From Monolithic to Microservices Amazon Web Services
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017Docker, Inc.
 
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...Edureka!
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecturetyrantbrian
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...Simplilearn
 

La actualidad más candente (20)

Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
Microservices
MicroservicesMicroservices
Microservices
 
From Monolithic to Microservices
From Monolithic to Microservices From Monolithic to Microservices
From Monolithic to Microservices
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Docker
DockerDocker
Docker
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
 
DevOps - A Gentle Introduction
DevOps - A Gentle IntroductionDevOps - A Gentle Introduction
DevOps - A Gentle Introduction
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Microservices
MicroservicesMicroservices
Microservices
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 

Destacado

Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioJérôme Petazzoni
 
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roofLibcontainer: joining forces under one roof
Libcontainer: joining forces under one roofMirantis IT Russia
 
Microservices and docker
Microservices and dockerMicroservices and docker
Microservices and dockerVõ Duy Tuấn
 
A microservice approach for legacy modernisation
A microservice approach for legacy modernisationA microservice approach for legacy modernisation
A microservice approach for legacy modernisationluisw19
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale ManagementVõ Duy Tuấn
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service ArchitectureEduards Sizovs
 
Microservices and SOA
Microservices and SOAMicroservices and SOA
Microservices and SOACapgemini
 
Docker Registry V2
Docker Registry V2Docker Registry V2
Docker Registry V2Docker, Inc.
 

Destacado (9)

Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific Trio
 
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roofLibcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
 
Microservices and docker
Microservices and dockerMicroservices and docker
Microservices and docker
 
A microservice approach for legacy modernisation
A microservice approach for legacy modernisationA microservice approach for legacy modernisation
A microservice approach for legacy modernisation
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale Management
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service Architecture
 
Microservices and SOA
Microservices and SOAMicroservices and SOA
Microservices and SOA
 
Scaling Docker Registry
Scaling Docker RegistryScaling Docker Registry
Scaling Docker Registry
 
Docker Registry V2
Docker Registry V2Docker Registry V2
Docker Registry V2
 

Similar a Microservices and docker

Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
 
Designing Microservices
Designing MicroservicesDesigning Microservices
Designing MicroservicesDavid Chou
 
DevOps and Microservice
DevOps and MicroserviceDevOps and Microservice
DevOps and MicroserviceInho Kang
 
Business and IT agility through DevOps and microservice architecture powered ...
Business and IT agility through DevOps and microservice architecture powered ...Business and IT agility through DevOps and microservice architecture powered ...
Business and IT agility through DevOps and microservice architecture powered ...Lucas Jellema
 
Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Ken Owens
 
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...Lightbend
 
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig DicksonAWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig DicksonAmazon Web Services Korea
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesRick Hightower
 
Evolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesEvolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesHector Tapia
 
AWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWSAWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWSAmazon Web Services
 
DevOps and BigData Analytics
DevOps and BigData Analytics DevOps and BigData Analytics
DevOps and BigData Analytics sbbabu
 
Moving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesMoving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesHussein Salman
 
Cloud Foundry Technical Overview at IBM Interconnect 2016
Cloud Foundry Technical Overview at IBM Interconnect 2016Cloud Foundry Technical Overview at IBM Interconnect 2016
Cloud Foundry Technical Overview at IBM Interconnect 2016Stormy Peters
 
Microservice Pattern Launguage
Microservice Pattern LaunguageMicroservice Pattern Launguage
Microservice Pattern LaunguageInho Kang
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015WaveMaker, Inc.
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupMatt Ray
 
Microservices and Best Practices
Microservices and Best Practices Microservices and Best Practices
Microservices and Best Practices Weaveworks
 

Similar a Microservices and docker (20)

Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 
Designing Microservices
Designing MicroservicesDesigning Microservices
Designing Microservices
 
DevOps and Microservice
DevOps and MicroserviceDevOps and Microservice
DevOps and Microservice
 
Business and IT agility through DevOps and microservice architecture powered ...
Business and IT agility through DevOps and microservice architecture powered ...Business and IT agility through DevOps and microservice architecture powered ...
Business and IT agility through DevOps and microservice architecture powered ...
 
Newt global meetup microservices
Newt global meetup microservicesNewt global meetup microservices
Newt global meetup microservices
 
Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015
 
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
 
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig DicksonAWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and Kubernetes
 
Evolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesEvolving your Architecture to MicroServices
Evolving your Architecture to MicroServices
 
AWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWSAWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWS
 
DevOps and BigData Analytics
DevOps and BigData Analytics DevOps and BigData Analytics
DevOps and BigData Analytics
 
Moving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesMoving Applications into Azure Kubernetes
Moving Applications into Azure Kubernetes
 
Cloud Foundry Technical Overview at IBM Interconnect 2016
Cloud Foundry Technical Overview at IBM Interconnect 2016Cloud Foundry Technical Overview at IBM Interconnect 2016
Cloud Foundry Technical Overview at IBM Interconnect 2016
 
Microservice Pattern Launguage
Microservice Pattern LaunguageMicroservice Pattern Launguage
Microservice Pattern Launguage
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native Meetup
 
Architecting for Scale
Architecting for ScaleArchitecting for Scale
Architecting for Scale
 
Microservices and Best Practices
Microservices and Best Practices Microservices and Best Practices
Microservices and Best Practices
 

Último

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Microservices and docker

  • 1. State of the Art in Microservices Microservices architecture and docker Alexander Ivanichev November 2015
  • 2. AGENDA • Evolution of Software Architecture • Docker concepts • Creating docker hosts with docker-machine • Running docker • Running an Application Server in Docker • Image vs. Container • Changing container behaviour • 3 ways to deploy an application • How to link multiple containers • Introduction to microservices
  • 3. EVOLUTION OF SOFTWARE ARCHITECTURE Methodology Process Patterns Platform Waterfall Agile Lean Engineering Continuous Delivery Microservice Architecture Cloud Scrum 3-Tier Layered Windows / Linux Gated 2-Tier Monolithic Windows Device Any DeviceBrowserDesktop
  • 4. MARKET EVOLUTION Thick, client – server app On thick client 1995 Well-defined stack: • O/S • Runtime • Middleware Monolithic Physical Infrastructure 2015 Thick, app on any device Assembled by developers using best available services Running on any available set of physical resources
  • 6. WHAT IS A SERVICE? The service is peace of software which provides functionality to other peace's of software. Service provides functionality to application for example: Service that provides CRUD orders from database , communicated over network. DB Service Website Mobile app Desktop app APP
  • 7. WHAT IS MICROSERVICE ? An architecture of designing a software in a set of independent services loosely coupled via lightweight communication. Recommenda tion Service (MongoDB) Rating Service (Neo4j) Analysis Service (Spark) Movie Service (MySQL) User Service (MySQL) Discovery Service • Application that is spilt into small pieces(suite of small services) • Each service built around business capabilities (1 piece = 1 responsibility) and independently deployable • Each service running in its own process • loosely coupled : Inter-process communication mechanism, e.g. HTTP, Message Queue • Bare minimum centralized management service • Each service can be in different programming language and use different data storage technologies
  • 8. Microservice formal definition: Loosely coupled service oriented architecture with bounded contexts
  • 9. If every service has to be updated at the same time it’s not loosely coupled Microservice formal definition Loosely coupled service oriented architecture with bounded contexts
  • 10. If every service has to be updated at the same time it’s not loosely coupled A Microservice formal definition Loosely coupled service oriented architecture with bounded contexts If you have to know too much about surrounding services you don’t have a bounded context. See the Domain Driven Design book by Eric Evans.
  • 11. WE HAVE SOA , WHY DOING A MICROSERVICES SOA problems: • How to size a service - traditional resulted in monolithic services • Service failure – takes all application offline • Scale specific part of a service Why Microservices: • Efficiently scalable applications • Flexible applications • High performance applications
  • 12. SOA VS MICROSERVICES Microservices are the kind of SOA we have been talking about for the last decade. Microservices must be independently deployable, whereas SOA services are often implemented in deployment monoliths. Classic SOA is more platform driven, so microservices offer more choices in all dimensions. SOA is an architectural pattern in which application components provide services to other components. However, in SOA those components can belong to the same application. On the other hand, in microservices these components are suites of independently deployable services.
  • 13. SOA THE MONOLITHIC Accounts Products Inventory Promotions Internet Shopping website Orders Internal Support website Data Access Service DB Customer • No restriction on size • Longer development times • Inaccessible features • High levels of coupling • Scaling requires duplication of the whole • Minor change could result in complete rebuild
  • 15. WHY MICROSERVICES • Need to respond to change quickly • Need for reliability • Business domain-driven design • Automated test tools • Release and deployment tools • On-demand hosting technology • On-line cloud services • Need to embrace new technology • Asynchronous communication technology • Simpler server side and client side technology • Shorter development times • Reliable and faster deployment • Enables frequent updates • Decouple the changeable parts • Security • Increased uptime • Fast issue resolution • Highly scalable and better performance • Better ownership and knowledge • Right technology • Enables distributed teams
  • 16. MICROSERVICES DESIGN PRINCIPLES High Cohesion Single thing done well Single focus Approach: Keeps splitting service until it only has one reason to change Autonomous Independently changeable Independently deployable Approach: Loosely coupled system, versioning strategy, microservice ownership by team Business Domain Centric Represent business function or represent a business domain Approach: Business domain specific Subgroup into functions and areas Resilience Embrace Failure Default or degrade functionality Approach: Design for known failures Fail fast and recover fast Observable See system health Centralized logging and monitoring Approach: Tools for real-time centralized monitoring and centralized logging Automation Tools for testing and feedback Tools for deployment Approach: Continuous integration tools Continuous deployment tools
  • 18. SYNCHRONOUS COMMUNICATION Remote procedure call (RPC) • Sensitive to change HTTP • Work across the internet • Firewall friendly REST • CRUD using HTTP verbs • Natural decoupling • Open communication protocol • REST with HATEOS Service One ServiceTwo http://Service/Account/23 HTTP Verbs: POST PUT GET DELETE JSON/XML 1. Make call 2. Wait… 3. Response received Synchronous issues • Both parties have to be available • Performance subject to network quality • Clients must know location of service (hostport)
  • 19. ASYNCHRONOUS COMMUNICATION Event based • Mitigates the need of client and service availability • Decouples client and service Message queueing protocol • Message Brokers • Subscriber and publisher are decoupled • Microsoft message queuing (MSMQ) • RabbitMQ • ATOM (HTTP to propagate events) Asynchronous challenge • Complicated • Reliance on message broker • Visibility of the transaction • Managing the messaging queue Real world systems • Would use both synchronous and asynchronous Accounts Service Products Service Inventory Service Promotions Service API Gateway Internet Client Shopping website Orders Service Internal Support website Message Broker
  • 20. API GATEWAY • Request routing • Bundling multiple calls (Composition) • Protocol translation • Authentication • Caching • Versioning • Monitoring • Load balancing API Gateway is a server that is the single entry point into the system. The API Gateway encapsulates the internal system architecture and provides an API that is tailored to each client.
  • 21. .NET STACK TOOLS FOR MICROSERVICES CI/ CD TeamCity Docker Testing xUnit.net NUnit Moq FsCheck Communication REST Protocol Buffers RabbitMQ Particular MassTransit Persistence MongoDB RavenDB MySQL Cassandra Redis* Memcached* Logging and monitoring Serilog Seq StatsD Graphite Grafana Cabot - monitor and alert Technology freedom, use the best tools available.
  • 22. Demo
  • 24. WHAT IS DOCKER? “ DOCKER IS AN OPEN PLATFORM FOR BUILDING, SHIPPING AND RUNNING DISTRIBUTED APPLICATIONS. docker.io Docker engine Docker Hub
  • 25. APPLICATION DEPLOYMENT HISTORY MY APP + A REAL SERVER = But wait just a moment ! Shouldn't it be all about applications? Best practice is: Server application 1 : 1
  • 26. WHAT IF WE WANT RUN MULTIPLE APPS? [1] [2] [3] [4] …………...…….….. [10] [+] [+] [+] [+] 100% 50% 15% 10GB disk space 4GB RAM 5% CPU 100GB disk space 40GB RAM 50% CPU x 10 =
  • 27. DOCKER VS VM App A Bins/Libs Guest OS App A Bins/Libs Guest OS Hypervisor Host OS Server Infrastructure Virtual Machine • REUSABLE IMAGES • SNAPSHOTS • SIMPLIFY CLUSTERS CREATION Problems? YES!! "TOO HEAVY" App A Bins/Libs App A Bins/Libs Docker Engine Host OS Server Infrastructure Docker
  • 28. WHAT IS A CONTAINER? Host OS Server Infrastructure Physical Machine APP User Space APP User Space APP User Space / dev var proc sda sda1 lib / dev etc lib sda sda1 systemd proc udev / dev etc lib sda sda1 systemd proc udev Container 1 (mnt namespace 1) Container 2 (mnt namespace2) Docker Engine Containers Container ~ VM but lightweight
  • 29. HOW CONTAINERS WORK? Physical or Virtual Server Docker Engine libcontainer LXC Host OS Namespaces cgroups Capabilities Linux Kernel LXC = "LINUX CONTAINERS" OS-LEVEL VIRTUALIZATION FOR RUNNING MULTIPLE ISOLATED LINUX SYSTEMS CGROUPS = "CONTROL GROUPS" LINUX KERNEL FEATURE THAT LIMITS AND ISOLATES THE RESOURCE USAGE (CPU, DISK I/O, NETWORK, ETC.) AUFS= "ADV. MULTI LAYERED UNIFICATION FS" FILESYSTEM WHICH IS BASED ON IMAGES WHERE EVERY MODIFICATION IS A DIFF FROM THE PREVIOUS ONE (LIKE COMMITS IN GIT)
  • 30. HOW TO INSTALL ? Linux: $ wget -qO- https://get.docker.com/ | sh Mac OSX: https://github.com/docker/toolbox/releases/download/v1.9.1c/DockerToolbox- 1.9.1c.pkg Windows: https://github.com/docker/toolbox/releases/download/v1.9.1c/DockerToolbox- 1.9.1c.exe http://docs.docker.com/engine/installation/ To use docker it's necessary a linux machine. But.. for Windows and Mac OS X there are some tools to run docker in these OS with a Virtual Machine”.
  • 31. DOCKER HUB “The Docker Hub is a cloud-based registry service for building and shipping application or service containers” 5.6M Pulls per Day 240K Repositories on Docker Hub 65 Pulls per Second https://hub.docker.com/
  • 32. DOCKER ARCHITECTURE Docker client docker search docker run docker start docker pull Local / Remote Docker daemon Container 1 Container 2 Host OS … DOCKER CLIENT • binds to daemon via unix socket • can access if user is in docker group can • bind to TCP or other UNIX socket DOCKER DAEMON • runs as root user • creates UNIX socket for client
  • 33. Demo time! #1 Docker hello world
  • 34. Docker Client docker run hello-world Docker Host docker run <image x> Image 1 Image 2 Image 3 Docker Hub Container 1 Container 2 Image 1 Image 2 Image 3 DOCKER DEMO OVERVIEW Daemon
  • 35. DOCKER BASICS To show all docker commands just run docker binary docker Get command help docker pull --help Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST] Pull an image or a repository from a registry -a, --all-tags=false Download all tagged images in the repository --disable-content-trust=true Skip image verification --help=false Print usage
  • 36. DOCKER BASICS To show installed docker version docker -v Download a docker Ubuntu image docker pull ubuntu Interact with a container docker run -it ubuntu bash Show containers docker ps Show container run history docker ps -a
  • 37. HOW DOES IT WORK? Image RegistryContainer Build DistributeDeploy
  • 38. DOCKER IMAGES Docker images are the basis of containers. Previously we’ve used Docker images that already exist, for example the ubuntu image. • Immutable templates • Used to create containers • Used to create other images • Images built in layers • Uses union filesystems to glue layers together • Layer are cached when build • Can be uploaded to registry docker images # To view all images available docker run --rm -ti somecontainer bash Basic images commands: • Built from instructions in Dockerfile • Built FROM base image • Each instruction in Dockerfile creates new layer
  • 39. DOCKER LAYERS • AUFS - AnotherUnionFS/advanced multi layered unification filesystem • Each layer has its own hash • Layer can be tagged • Layers are shared docker images --tree
  • 40. 2 WAYS TO CREATE DOCKER IMAGES 1.COMMIT WAY docker commit -m "<menssage>" <image name> docker history <image name> 2.DOCKERFILE WAY docker build -t <tag> <dockerfile path> DOCKERFILE REFERENCE FROM MAINTAINER WORKDIR ENV RUN COPY ADD EXPOSE VOLUME USER CMD Dockerfile example: And then we can build it docker build -t somecontainer somecontainer/ FROM ubuntu RUN apt-get update && apt-get install -y python telnet ENTRYPOINT ["/bin/bash"]
  • 41. IMAGES COMMANDS // Build new image based on Dockerfile > docker build -t neueda/myimage:tag ./path/to/Dockerfile // List containers (-a to print also intermediate layers) > docker images // Create container based on ubuntu image, create pseudo-TTY, run command in interactive mode > docker run -t -i ubuntu:14.04 rm -rf /etc // Create new image based on mutations made by container > docker commit -m "Removed /etc directory" -a "Nikolajs Arhipovs" $CONTAINER neueda/ubuntu // Add tag to untagged image > docker tag 5db5f8471261 neueda/ubuntu:broken // Push to repository (Docker Hub) > docker push neueda/ubuntu:broken // Remove image with all intermediate layers on host > docker rmi neueda/ubuntu:broken Example commands
  • 42. Demo time! #2 Building custom image
  • 43. DOCKER CONTAINER • Built on top of image • Adds RW layer using union fs Launch (build-time) (runtime) Image Container 511136ea3c5a (rootfs) 6170bb7b0ad1 9cd978db300e 87026dcb0044 coreos/apache Metadata Image layering 3) 87026dcb0044 2) 9cd978db300e 1) 6170bb7b0ad1 0) 511136ea3c5a etc….. Docker Image One per container Can be shared by many containers Thin writable layer
  • 44. CONTAINERS COMMANDS Example commands // List containers (-a to print also stopped containers) > docker ps // Show stdout of a container (works as `cat`) > docker logs $CONTAINER_ID // Attaches to currently running container (like `tail -f`), same as `docker logs -f` > docker attach $CONTAINER_ID // Stop running containers > docker stop $CONTAINER_ID1 $CONTAINER_ID2 // Start stopped containers > docker start $CONTAINER_ID // Show running processes > docker top $CONTAINER_ID // Show all docker-related meta info like net interfaces, port forwarding, volumes > docker inspect $CONTAINER_ID
  • 45. DOCKER REGISTRY • Images can be pushed to registry • Images can pulled from it • Images can be built on FROM other images pulled from repository ~ $ docker push -h Usage: docker push NAME[:TAG] Push an image or a repository to the registry --disable-content-trust=true Skip image signing ~ $ docker push alexiv/hello The push refers to a repository [alexiv/hello] (len: 1) b88f9422f14d: Image push failed Please login prior to push: Username: alexiv Password: Email: alexiv@gmail.com WARNING: login credentials saved in /Users/alex/.dockercfg. Login Succeeded The push refers to a repository [alexiv/hello] (len: 1) b88f9422f14d: Image already exists 91e54dfb1179: Image successfully pushed d74508fb6632: Image successfully pushed c22013c84729: Image successfully pushed d3a1f33e8a5a: Image successfully pushed Digest: sha256:d659f9011eab6d04b3d9fd9f6324e23505bd1299c52d295c4b04ebe3e58878ce ~ $ Publish image to registry:
  • 46. Demo time! #3 Publishing custom to HUB
  • 47. DOCKER VOLUME A data volume is a specially-designated directory within one or more containers that bypasses the Union File System. ~ $ ls /Users/baptou/myDirectory file1 file2 file3 ~ $ docker run -it -v /Users/baptou/myDirectory:/opt ubuntu:latest /bin/bash root@29088b02f260:/# ls /opt file1 file2 file3 root@29088b02f260:/# rm /opt/file2 root@29088b02f260:/# ls /opt file1 file3 root@29088b02f260:/# exit exit ~ $ ls /Users/baptou/myDirectory file1 file3 ~ $
  • 48. DOCKER KITEMATIC Run containers through a simple, yet powerful graphical user interface.
  • 49. DOCKER FOR WINDOWS / .NET STACK • Visual Studio 2015 Tools for Docker • Docker Toolbox • Windows server 2016
  • 50. DOCKER NEXT STEPS Tutum Build, deploy, and manage your apps across any cloud Docker Universal Control On-premises management solution for Docker apps - regardless of where they run Docker Swarm Docker Swarm is native clustering for Docker. Kubernetes Manage a cluster of Linux containers as a single system