Building Microservices
with Docker
Roman Melnyk
Content
Introduction to microservices architecture
‘Docker container’ concepts
Limitations and pitfalls
A short DEMO to start use Docker containers
What does microservice mean?
Microservice is a software architecture style
in which complex applications are composed of
small, independent processes communicating
with each other using language-agnostic APIs
These services are small, highly decoupled and
focus on doing a small task, facilitating a
modular approach to system-building.
Monolithic vs Microservices Architecture
What is the value of Docker containers?
Docker containers wrap up a piece of software
in a complete filesystem that contains everything
it needs to run: code, runtime, system tools,
system libraries – anything you can install on a
server. This guarantees that it will always run the
same, regardless of the environment it is running
in.*
_____
* https://www.docker.com/whatisdocker
How is this different from virtual machines?
Containers have similar resource isolation and allocation benefits as virtual machines but a
different architectural approach allows them to be much more portable and efficient.
Virtual Machines
Each virtual
machine includes
the application, the
necessary binaries
and libraries and
an entire guest
operating system -
all of which may
be tens of GBs in
size.
Containers
Containers include the
application and all of its
dependencies, but
share the kernel with
other containers.
They run as an isolated process in userspace on the
host operating system. They’re also not tied to any
specific infrastructure – Docker containers run on any
computer, on any infrastructure and in any cloud.
Docker features
●Docker Engine
●Docker Hub
●Docker Trusted Registry
●Docker Machine
●Docker Swarm
●Docker Compose
Practical usage
single-service stateless host*
continuous development and integration
for development or testing purposes
___
* stateful service aren’t recommended without attached volumes or volume
plugins (Flocker, GlusterFS, Blockbridge)
Key concepts
●Images
●Containers
●Volumes
Limitations and pitfalls
1.Single process run
2.Performance
3.Natively works only on Linux
4.Security and safety usage base images
5.Client - Host incompatibility
Docker is native only to Linux
Good news for MS lovers - https://blog.docker.com/2015/08/tp-docker-engine-windows-server-2016/
Nearest Future of Docker
●Windows Docker containers
●Hosting docker containers
●Security improvements
●(Who knows?) Support docker on CPU level
like virtual machines
References and links
https://github.com/docker
http://microservices.io/patterns/microservices.html
http://technologyconversations.com/2015/01/07/monolithic-servers-vs-microservices/
http://docs.docker.com/
https://coreos.com/using-coreos/containers/
http://www.pluralsight.com/courses/docker-deep-dive

Building microservices with docker

Editor's Notes

  • #4 Properties of microservices architecture: The services are easy to replace Services are organized around capabilities, e.g. user interface front-end, recommendation, logistics, billing, etc Services can be implemented using different programming languages, databases, hardware and software environment, depending on what fits best Architectures are symmetrical rather than hierarchical (producer - consumer) A microservices-based architecture lends itself to a continuous delivery software development process[citation needed] is distinct from a Service-oriented architecture (SOA) in that the latter aims at integrating various (business) applications whereas several microservices belong to one application only
  • #6 All about applications on backend Every machine uses only partly utilisations VM cluster uses utilisation better but every VM instance grabs part of utilisation for OS and sometimes still need license Containers are more lightweight - just isolated instance of OS
  • #8 Docker Engine or “Docker” creates and runs Docker containers Docker Hub is our hosted registry service for managing your images. Docker Trusted Registry(DTR) supplies a private dedicated image registry. Docker Registry provides open source Docker image distribution. Docker Machine automates container provisioning on your network or in the cloud. Docker Machine helps you get Docker Engines up and running quickly. Machine can set up hosts for Docker Engines on your computer, on cloud providers, and/or in your data center, and then configure your Docker client to securely talk to them. Docker Swarm is used to host clustering and container scheduling. Docker Swarm pools several Docker Engines together and exposes them as a single virtual Docker Engine. It serves the standard Docker API, so any tool that already works with Docker can now transparently scale up to multiple hosts. Docker Compose defines multi-container applications. Docker Compose allows you to define a application’s components – their containers, configuration, links and volumes – in a single file. Then a single command will set everything up and start your application running.
  • #10 Images by OOP analogy are classes Containers are instantiated classes Volumes are just mounted volumes on Linux or referenced resources
  • #11 only one process - make sense since it is microservice even on Linux - containers harms performance. On other OSs harm because it is used as VM Non-Linux application cannot be handled by containers (not yet at least) here is no backward compatibility (dunno why :) )