KEMBAR78
Docker techzone | PPTX
Bjørn Nordlund
Build and share infrastructure as
easily as code
https://github.com/bjornno/dockerdemo
webserver
appserver
meldingskø
database
files
cache
OS
laptop
CI server On prem customer
cloud
http://www.linuxadvocates.com/2013/04/linux-containers-and-why-they-matter.html
Linux Containers (LXC)
LXC
Kernel
namespaces
chroot
cgroups
…
LXC
Kernel
namespaces
chroot
cgroups
…
Docker
AUFS
CLI REST
Create, list, delete, inspect, start, stop, commit, history….
Repository
Ship Boot #instances on
one physical
server
Bare Metal days minutes 1
VM’s minutes seconds 10-100
Containers seconds milliseconds 100-1000
demo
Dockerfile
FROM bjornno/ubuntu
RUN git clone https://github.com/bjornno/dockerdemo.git
WORKDIR /dockerdemo
RUN bundle
CMD ["rackup"]
Learn more on http://docker.io
Use Case Examples Link
Build your own PaaS
Dokku - Docker powered mini-Heroku.
The smallest PaaS implementation
you’ve ever seen http://bit.ly/191Tgsx
Web Based Environment for
Instruction
JiffyLab – web based environment for
the instruction, or lightweight use of,
Python and UNIX shell http://bit.ly/12oaj2K
Easy Application Deployment
Deploy Java Apps With Docker =
Awesome http://bit.ly/11BCvvu
Running Drupal on Docker http://bit.ly/15MJS6B
Installing Redis on Docker http://bit.ly/16EWOKh
Create Secure Sandboxes
Docker makes creating secure
sandboxes easier than ever http://bit.ly/13mZGJH
Create your own SaaS Memcached as a Service http://bit.ly/11nL8vh
Continuous Integration and
Deployment
Next Generation Continuous Integration
& Deployment with dotCloud’s Docker
and Strider http://bit.ly/ZwTfoy
Lightweight Desktop
Virtualization
Docker Desktop: Your Desktop Over SSH
Running Inside Of A Docker Container http://bit.ly/14RYL6x
https://github.com/bjornno/dockerdemo

Docker techzone

Editor's Notes

  • #2 I will present some of the basic building blocks of todays cloud services, or Plattform As A service frameworks. I will present a tool called docker, that is an open source implementation, it’s similar to other tools used by For example cloud foundry or heroku. ---- CF use warden
  • #3 Here I have a small webapp that runs in Cloud Foundry, an open source paas solution. Actually a cloud foundry hosted on my laptop I can deploy my app with a single push command, it will get access to all services available from the plattform, right now my app consists of a load balancer, and an appnode. If I want to change the infrastructure I can do it easily. I can for example add databases, message queues, or scale up by adding more memory, or scale out adding more app nodes like this (cf scale –i 5). Wow, I added 50 nodes And it all happens in seconds. How do they do this? ---------------- cf services
  • #4 They all use what we call containers – It is similar to a virtual machine, but without all the friction and overhead of a virtual machine.
  • #5  The idea is the same as cargo containers. You can put whatever you like into them, but seen from the outside it’s the same, its one unit. You could put a OS, some files, a database, an appserver, anything into it.. And ship it.
  • #6 You can then run it on your local machine, a integration test server, deploy it to a customer or to a public cloud provider. Without changing anything. You will always have the exact same environment
  • #7 you can stack multiple containers together on the same servers. The containers could for example be multiple instances of the same application but for different customers running completely isolated from each other, providing multi tenancy Or it could be different applications
  • #8 Or you can scale your app out by deploying multiple containers running on multiple servers
  • #9 So one implementation of such a container is the linux container or LXC, That lets you run multiple linux system within one linux system ----- Fast: ~97% of bare metal start/stop in miliseconds Agile: container can be moved seamlessly between local, vm, bare metal with a click of a button, or scripted Flexible: containerize a whole system with os, db, etc or just an application. Freedom Leightweight: On a typical physical server, with average compute resources, you can easily run: ● 10-100 virtual machines ● 100-1000 containers Cloudy: support from various cloud management framworks, like open stack Is becoming the new “unit of deployment” Changing how we develop, package, deploy and manage apps at all scales (test/dev to production) Removes the friction of using virtual machines Simplify workflow and provides performance benefits. It’s the basis of most paas solutions like heroku, cloudfoundry etc
  • #10  A linux container uses features from the linux kernel to create isolated environments on the same machine. Seen from the inside of such an environment It looks like a virtual machine but from the outside, the host os, it looks like a process. But since LXC is pretty hard to work with directly ----- like control groups for resource isolation (cpu, memory, I/O, network etc), and kernel namespaces to isolate an applications view of the surrounding operating system, like processes, users, network, filesystems etc. And chroot to change the root directory to the container. In effect you get an isolated environment where you can install your own linux os, and your own applications without the cost of creating a virtual machine. --------- Namespaces: Processes, network interfaces, filesystem, hostname, users eg you can have multiple processes with pid=42 in different environments Control groups: cgroups kernel feature to limit and isolate resource usage (cpu memory disk I/O etc) Chroot: Change the root to a directory on the filesystem for a single process, the process can not normally access files on the outside of this directory Aufs: Writable single-s
  • #11 We use docker, which is a tool that adds a user friendly layer to work with linux containers. You get a command line interface and a rest interface. You can create new images, commit their state, push/pull to a repository and a bunch of other usefull features. ---------- “A docker is the person that works on the dock loading and unloading ships” Docker has a command line interface with git like commands for pulling down images, pushing new versions, diff, history etc. And it heavily uses aufs, which is a ……….stackable unification file system wich unifies several directories and provides a single directory. It is a layered filesystem where many containers can have their own filesystems, but all common files are shared or copied. I will not go into detail how this work, but the effect is that you only need to change the diffs between two containers using mostly the same files. With docker and linux containers you have the building blocks to create the containers that can run in the cloud. Open stack and many cloud providers has native support for docker containers. But it could also be the building blocks to create your own cloud or even your own paas. Giving you more flexibility and control, and the possibility to tailor the infrastructire exactly to your need. So I will finish up by demonstrating some of the basics of docker and how you can use the basics to implement more advanced use cases..
  • #12 And the benefit of working with containers is many. As you already have seen in the first demo, where I ran more than 50 containers on my laptop. It is really fast, little overhead both for memory, processing and size. They share the same kernel as the host, and only the differences to the file systems are stored, all equal files is stored just once. ----------- And it is Fast: ~97% of bare metal start/stop in miliseconds Leightweight: On a typical physical server, with average compute resources, you can easily run: ● 10-100 virtual machines ● 100-1000 containers They use marginally more resources than the applications you run, as it shares most with the surrounding OS and other containers.
  • #13 So lets finish with some hands on with docker docker run -i -t -p 80:9292 bjornno/ubuntu /bin/bash git clone https://github.com/bjornno/dockerdemo.git cd dockerdemo bundle rackup http://localhost:8000 diff Commit History Share Normally you would not create images interactively like this, but use a Dockerfile…
  • #14 Normally you would not create the images interactively like this, but instead have a Dockerfile (think of it as a makefile for building a container), that is checked in with your application source code. You always start with a image and adds stuff to it. Here I start with a ruby image which is an ubuntu with ruby tools pre installed. docker build –t bjornno/app . docker run -p 80:9292 bjornno/app
  • #15 So that was a very short intro to docker. I hope you now know a little more how the cloud and PaaS solutions works. And that you could use the same tools locally for packaging your apps, testing, and deploying. Check out dockers homepage for more resources. And also my git repo for this demo. Thank you..