ROME 27-28 march 2015
Alessandro Cinelli (cirpo)
Apt-get no more
let Vagrant, Puppet and Docker
take the stage
“it works on my
machine”
Title
subtitle
“Everything
is written in the
README”
“Everything
is written in the wiki”
Title
subtitle
“oh shit, I forgot to
update XYZ”
Title
subtitle
“cool this opensource
project on github…
how can I run it?”
“I don’t f*#c?ing care
about the platform,
I want to build
something cool
NOW!”
SOLUTIONS?
REMOTE
MACHINES
https://www.flickr.com/photos/mysterybee/1659329016
VIRTUAL
MACHINES
BUT VIRTUAL MACHINES COULD BE
HUUUUUUGE
enter
“Create and configure lightweight,
reproducible, and portable development
environments.”
YOU CAN HAVE A VM WITH FEW Kbs
download and install vagrant
download and install vagrant
create a Vagrantfile
download and install vagrant
create a Vagrantfile
run “vagrant up”
download and install vagrant
create a Vagrantfile
run “vagrant up”
enjoy
VagrantFile
VagrantFile
vm box name
VagrantFile
base box url
vm box name
VagrantFile
base box url
vm box name
vm ip
VagrantFile
base box url
vm box name
vm ipshared folder
VagrantFile
base box url
vm box name
vm ipshared folder
vm ram
VagrantFile
base box url
vm box name
vm ipshared folder
vm ram
vm #cpus
BOXES
BOXES
AUTOMATE
SETUP
PROCESS
(PROVISIONING)
PROVISIONERS
VM
$ vagrant up
provisioners
$ ssh
thanks Rohit Dantas
https://github.com/joindin/joindin-vm
how to automate the
provisioning?
X
IF THE STACK DOESN’T CHANGE
TOO MUCH
JUST PROVIDE A READY MADE
VM MACHINE…
THE PROVISIONER WILL ONLY
CHANGE CONFIG FILES
BUILD A NEW MACHINE IF
YOU HAVE TO UPGRADE/ADD
A SERVICE
“Operating-system-level virtualisation is a
virtualisation method where the kernel of an
operating system allows for multiple isolated
user space instances, instead of just one.
Such instances, often called CONTAINERS, or
jails, may look and feel like a real server from
the point of view of its owners and users.”
http://en.wikipedia.org/wiki/Docker_%28software%29
lego
ONE CONTAINER
=
ONE COMMAND
DIFFERENCE BETWEEN A VM AND DOCKER
HOST OS
GUEST
OS
HYPERVISOR
BIN/
LIBS
APP A
APP C
APP B
GUEST
OS
BIN/
LIBS
APP Z
APP H
APP B
GUEST
OS
BIN/
LIBS
APP A
APP D
APP L
HOST OS
DOCKER ENGINE
BIN/
LIBS
APP A
BIN/
LIBS
APP Z
BIN/
LIBS
APP D
BIN/
LIBS
APP B{ {
VM
VS
(VM)
FIGHT IMAGE
environment dev all (dev, staging, live)
boot speed minutes seconds
host dependency almost everywhere linux
VS
Full isolation and garanteed resources ?



Then go with vagrant/VM
VS
Isolated processes and tons of them?
Then go with Docker
THE DOCKER CREW INVENTED
CONTAINERS?
THE DOCKER CREW INVENTED
CONTAINERS?
no
THE DOCKER CREW INVENTED
CONTAINERS?
NO
Linux CONTAINERS (LCX)
came from FreeBsd jails and chroot, 

at least 5 years ago
used by Heroku(PaaS)
Docker is a great, super
mega awesome way to
orchestrate containers
numbers
DIFFERENCE BETWEEN DOCKER AND A VM
WITH DOCKER
YOU DON’T HAVE THE
OVERHEAD GIVEN BY THE
VIRTUALISATION
DockerFile
DockerFile
container image
DockerFile
container image
commands while building the container
}
DockerFile
container image
commands while building the container
copy some content while building
the container
}
DockerFile
container image
commands while building the container
copy some content while building
the container
declare a volume: data accessible by other containers
and useful to mount a filesystem
}
DockerFile
container image
commands while building the container
copy some content while building
the container
declare a volume: data accessible by other containers
and useful to mount a filesystem
environment variable
}
DockerFile
container image
commands while building the container
copy some content while building
the container
declare a volume: data accessible by other containers
and useful to mount a filesystem
environment variable
container port exposed to other containers
}
DockerFile
container image
commands while building the container
copy some content while building
the container
declare a volume: data accessible by other containers
and useful to mount a filesystem
environment variable
container port exposed to other containers
the container command
executed when you run it
}
Build the container:
$: docker build -t node-app .
Run the container:
$: docker run -it node-app
Build another container:
$: docker build -t my-redis .
Run the container:
$: docker run -it my-redis
Link them and enjoy:
$: docker run --link my-redis:redis
-p 9200:9200 -d node-app
DEMO
windows 98 bsod
+
why vagrant and docker?
YES YOU CAN!
Docker still requires Linux
kernel 3.8 or higher.
This bounds considerably the
environments Docker can
natively run on.
BUT YOU SHOULDN’T…
docker-compose (prev fig)
dubai
dubai
namshi
namshinamshi
SOA
Service Oriented
Architechture
DOCKER IS A PERFECT MATCH!
DOCKER IS A PERFECT MATCH!
EVEN FOR DEVELOPMENT
fake service? no problem
DO YOU NEED TO FAKE A
SERVICE?
NO PROBLEM, JUST SPIN UP A
CONTAINER IN NO TIME
NGINX-PROXY
https://github.com/jwilder/nginx-proxy
APIDOC (DEMO)
APIDOC (DEMO)
NGINX-PROXY
DOCKER PROS
Matter of seconds to start an image
Can start multiple copies immediately
Central repo for images
You can go on staging and live from dev with the same
container
Versioning
DOCKER CONS
It really works really well just on Linux atm
It’s a young project, things change very fast
Lack of proper management tool
DOCKER CONS
It really works really well just on Linux atm
It’s a young project, things change very fast
Lack of proper management tool
boot2docker
Kitematic
github.com/namshi/node-dock
node-dock
NODE-DOCK
Docker disk space cleanup
$: docker rm $(docker ps -a -q)
$: docker images | grep "<none>" | awk
'{ print "docker rmi " $3 }' | bash
https://github.com/dummymael/dotfiles/blob/
1859a36afba2252f86a0a1ff8d5fb442e74b7a0e/tools/
docker_clean_vfs.py
$: pip install docker-py
@cirpo
github.com/cirpo
/
THANKS!
credits
http://blog.docker.com/media/Docker_Infographic_FINAL.jpg
https://www.flickr.com/photos/chuddlesworth/7059061549
Tim Haak https://speakerdeck.com/timhaak/vagrant-is-so-last-year-why-arent-you-using-docker-yet
Rohit Dantas https://speakerdeck.com/rohitdantas

Apt get no more let Vagrant, Puppet and Docker take the stage