Download - Docker and the Container Revolution
The container revolutionStaring Docker, CoreOS, Rocket and guests
December 27th, 2014 Anchor Coworking
Romain Dorgueil [email protected]
Who am I ?
Romain DorgueilFounding partner / Tech Advisor @ WeAreTheShops
Founder / CTO @ Monk
➔ Startupper➔ DevOps➔ Python & Linux➔ Electronic sound distorder
Monk.cx ?
Most affordable Chief Data Officer ever.
➔ Data management➔ Data processing➔ Data visualisation➔ Data reporting
➔ Geek & Biz friendly.
Monk.cx ?
Most affordable Chief Data Officer ever.
➔ Different flavours◆ Software (runs on your laptop)◆ Service (runs on our servers)◆ Appliance (runs on your servers)
➔ Distributed◆ Sync & deploy as simple as git pull/push
</advertising>
Containers : the origins
Containers : the origins
«The system, developed after World War II, dramatically reduced transport costs, supported the post-war boom in international trade, and was a major element in globalization.»
Source : Wikipedia : Containerization
Containers : the origins
IT Companies : Dev & Ops
➔ Dev & Ops silos are communication antipattern
➔ Communication is expensive
IT Companies : Dev & Ops
➔ Developer release a software ... ◆ Don’t want to know about hosting
➔ Operations host a software …◆ Don’t want to know how it works
➔ Problem !
IT Companies : Dev & Ops
➔ Modern applications are more and more versatile …
◆ We try a lot more technologies◆ We build smaller components with a lot more
different stuffexample : a java frontend with lots of microservices in python, node, ruby and some distributed services written in haskell or go is not so rare.
➔ Ops can’t possibly know a lot about what they run.
Containers in computing
➔ Package applications in a normalized container
➔ Deliver things that always look the same from the outside
➔ Learn how to operate it once, and host anything the same way
➔ Developers can focus on development ➔ Operations can focus on operations
➔ Run things➔ Monitor running things➔ Don’t trust those running things➔ Don’t care about what’s running
Containers in computing
So what is Docker ?
Docker is an ecosystem defining norms and providing tools make the IT «container revolution» possible.
Docker is not the way. Docker is one way to containairise applications, and the first to get huge traction from professionals.
Traction ?
GAFAs and little brothers all says
«I’m doing it for ages»
or …
«I want a piece of the cake»
Docker VS Virtual Machines
Docker
➔ Modern Linux (3.8+)➔ Linux Containers (LXC)➔ Another Union File System (AUFS)➔ Docker Server (and client …)
Docker
➔ Client / Server➔ Manage lifecycle of LXC
◆ nsinit◆ nsenter
➔ Manage images◆ Build◆ Run
➔ Manage files◆ AUFS◆ Volumes◆ Backups
Docker : Images
➔ Complete snapshot of a system state➔ Hints about exposed ports➔ Infos about volumes
Docker : Images
Example
docker pull -a nginxdocker images | grep nginx
Docker : Containers
➔ Take an image➔ Add some environment➔ Run it
Docker : Containers
Example
docker run -p 8080:80 nginx:1.7.6
docker run -it --entrypoint=/bin/bash nginx:1.7.6 -i
docker run --detach -p 8080:80 nginx:1.7.6
docker ps
docker run --detach -p 8080:80 --name=web nginx:1.7.6
Docker : Volumes
➔ System runs in AUFS➔ Everything is ephemeral ...➔ … but volumes
Volumes are directories marked that will live in the host system.
Docker : Volumes
Example
docker run -p 8080:80 -v /usr/share/nginx/html nginx:1.7.6
mkdir website; vim website/index.html
docker run -p 8080:80 -v `pwd`/website:/usr/share/nginx/html nginx:1.7.6
docker run -p 8080:80 -v `pwd`/website:/usr/share/nginx/html:ro nginx:1.7.6
docker run -p 8080:80 -v `pwd`/website:/usr/share/nginx/html:ro nginx:1.7.9
Docker : Ports
Example
docker run -p 8080:80 nginx:1.7.6
docker run -P nginx:1.7.6
Docker : Links
App 1HTTP on port 8080
DatabaseMySQL (port 3306)
App 2HTTP on port 5000
Load balancerHTTP on port 80
Docker : Links
Example
In a moment, with demo.
Docker : App & Data Containers
Applications container run stuff.
Data containers are here to define volumes, and exist without running.
You can run a container with “volumes from” another container.
Docker : App & Data Containers
Example
docker run --name=dbdata mysql:5.5 true
docker ps -al
docker run --name=db -d -e MYSQL_ROOT_PASSWORD=root \ --volumes-from dbdata -p 3306:3306 mysql:5.5
mysql -h 127.0.0.1 -uroot -p
Dockerfiles
Create repeatable recipes to build containers.
Define exposed ports, volumes, what to include, etc.
Dockerfiles
Example
FROM google/python-runtimeMAINTAINER John Doe <[email protected]>COPY …EXPOSE …ENTRYPOINT …CMD …
docker build -t my-python-app .
docker run -p 8081:8080 my-python-app
Demo : Wordpress
Database already run in container “db”
Let’s start a wordpress container, with a link to db.
docker run --name wp --link db:mysql \-e WORDPRESS_DB_PASSWORD=root -d -P wordpress
Demo : Wordpress
Enough time ? Add a nginx front container.
upstream wordpress { server wordpress:5000;}
server { listen 80 default; server_name wordpress.local; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://wordpress; }}
The ecosystem : Docker Inc.
➔ Docker Hub➔ libcontainer➔ libswarm
The ecosystem : CoreOS
➔ CoreOS➔ etcd➔ fleetd➔ flannel➔ rocket
The ecosystem : Google
➔ Kubernetes➔ Google Container Engine➔ CAdvisor➔ Python runtime ...
The ecosystem : Apache
➔ Mesos
The ecosystem : Lot more ...
➔ Digital Ocean➔ Tutum➔ Amazon EC2 Container Service (ECS)➔ … endless list here ...
Q&A
Follow me on twitter : @hartym Ask me anything: [email protected]
Q&A
➔ Should docker be used on a per-website basis?
➔ How to easily setup docker and git deployment with some <insert your favorite here> backend?
Follow me on twitter : @hartym Ask me anything: [email protected]
Q&A
➔ Performance? Benchmarks?- Containers- AUFS
Follow me on twitter : @hartym Ask me anything: [email protected]
More Q&A
Follow me on twitter : @hartym Ask me anything: [email protected]
Thanks!
Follow me on twitter : @hartym Ask me anything: [email protected]