Containers, Docker and Microservices
Containers, Docker and Microservices
Containers, Docker and Microservices
Docker, and
Microservices
Jrme Petazzoni
(@jpetazzo)
Grumpy French DevOps
- Go away or I will replace you
with a very small shell script
Jrme Petazzoni
(@jpetazzo)
Built and scaled dotCloud
PAAS with 106 services
(I counted them!)
- some examples: hosts, nats,
containers, builds, snapshots,
metrics, billing, user permissions,
infrastructure management, logs, ...
outline
Outline
Why microservices?
What's the challenge?
How does Docker help?
Getting started with stacks of containers
why
microservices
what's the
challenge?
how does
Docker help?
the big
picture
Docker's mission
build, ship, and run any application, anywhere
Say again?
Build: package your application in a container
Ship: move that container from a machine to another
Run: execute that container (i.e. your application)
Any application: anything that runs on Linux
Anywhere: local VM, cloud instance, bare metal...
build
Dockerfile
FROM ubuntu:14.04
MAINTAINER Docker Team <education@docker.com>
RUN apt-get update
RUN apt-get install -y nginx
RUN echo 'Hi, I am in your container' \
>/usr/share/nginx/html/index.html
CMD [ "nginx", "-g", "daemon off;" ]
EXPOSE 80
ship
Docker Hub
Image name should be <username>/<reponame>
e.g.: jpetazzo/web
docker push
docker pull
Docker Hub
Image name should be <username>/<reponame>
e.g.: jpetazzo/web
docker push
docker pull
It's magic!
run
Benchmark: infiniband
any app
anywhere
anywhere*
*Limitations may apply.
CONTAINERS
They're stable, they said. Stack them, they said.
running
stacks of
containers
First steps
Online tutorial (in browser, JS based, zero install)
http://www.docker.com/tryit/
boot2docker (25 MB universal VM image)
http://boot2docker.io/
Scary install script
curl -sSL https://get.docker.com/ | sh
We have ordinary packages too!
And most clouds have Docker images
Checklist
Install boot2docker
Run your first container (echo hello world)
Write your first Dockerfile
Create your Docker Hub account (free)
Push image to Docker Hub
Setup automated build
Run your first complex app with Fig
Fig
Run your stack with one command: fig up
Describe your stack with one file: fig.yml
Example: run a (one node) Mesos cluster
- Mesos master
- Mesos slave
- Volt framework
master:
image: redjack/mesos-master
command: mesos-master --work_dir=/mesos
ports:
- 5050:5050
slave:
image: redjack/mesos-slave
links:
- master:master
command: mesos-slave --master=master:5050 --containerizers=docker,mesos
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/bin/docker
volt:
image: volt/volt
links:
- master:master
command: --master=master:5050
ports:
- 8080:8080
what's next?
Advanced topics
All Things Docker
http://blog.docker.com/
Running your own private registry
https://github.com/docker/docker-registry
Containers and security
http://www.slideshare.net/jpetazzo/docker-linux-containers-lxc-and-security
https://medium.com/@ewindisch/on-the-security-of-containers-2c60ffe25a9e
Service discovery
(look for ambassador pattern)
And more!
thank you!
questions?