docker intro at the google developer group and google cloud platform meet up
DESCRIPTION
Docker is the Open Source engine to author, run, and manage Linux Containers. This is a short introduction to Docker, what it is, what is for; it was given in the context of the Google Developer Group and Google Cloud Platform Meet-Up in San Francisco, end of March 2014.TRANSCRIPT
![Page 1: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/1.jpg)
![Page 2: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/2.jpg)
Introduction to Docker
March 2014—Docker 0.9.0
![Page 3: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/3.jpg)
@jpetazzo
● Wrote dotCloud PAAS deployment tools
– EC2, LXC, Puppet, Python, Shell, ØMQ...● Docker contributor
– Docker-in-Docker, VPN-in-Docker,router-in-Docker...CONTAINERIZE ALL THE THINGS!
● Runs Docker in production
– You shouldn't do it, but here's how anyway!
![Page 4: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/4.jpg)
What?
![Page 5: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/5.jpg)
Why?
![Page 6: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/6.jpg)
Deploy everything
● Webapps● Backends● SQL, NoSQL● Big data● Message queues● … and more
![Page 7: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/7.jpg)
Deploy almost everywhere
● Linux servers● VMs or bare metal● Any distro● Kernel 3.8 (or RHEL 2.6.32)
Currently: focus on x86_64.
(But people reported success on arm.)
![Page 8: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/8.jpg)
Deploy reliably & consistently
![Page 9: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/9.jpg)
![Page 10: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/10.jpg)
Deploy reliably & consistently
● If it works locally, it will work on the server● With exactly the same behavior● Regardless of versions● Regardless of distros● Regardless of dependencies
![Page 11: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/11.jpg)
Deploy efficiently
● Containers are lightweight– Typical laptop runs 10-100 containers easily
– Typical server can run 100-1000 containers
● Containers can run at native speeds– Lies, damn lies, and other benchmarks:
http://qiita.com/syoyo/items/bea48de8d7c6d8c73435
![Page 12: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/12.jpg)
The performance!It's over 9000!
![Page 13: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/13.jpg)
Is there really no overhead at all?
● Processes are isolated,but run straight on the host
● CPU performance = native performance
● Memory performance = a few % shaved off for (optional) accounting
● Network and disk I/O performance = small overhead; can be reduced to zero
![Page 14: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/14.jpg)
… Container ?
![Page 15: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/15.jpg)
High level approach:it's a lightweight VM
● Own process space● Own network interface● Can run stuff as root● Can have its own /sbin/init
(different from the host)
« Machine Container »
![Page 16: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/16.jpg)
Low level approach:it's chroot on steroids
● Can also not have its own /sbin/init● Container = isolated process(es)● Share kernel with host● No device emulation (neither HVM nor PV)
« Application Container »
![Page 17: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/17.jpg)
How does it work?Isolation with namespaces
● pid● mnt● net● uts● ipc● user
![Page 18: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/18.jpg)
How does it work?Isolation with cgroups
● memory● cpu● blkio● devices
![Page 19: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/19.jpg)
How does it work?Copy-on-write storage
● Create a new machine instantly(Instead of copying its whole filesystem)
● Storage keeps track of what has changed● Multiple storage plugins available
(AUFS, device mapper, BTRFS, VFS...)
![Page 20: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/20.jpg)
Union Filesystems(AUFS, overlayfs)
Copy-on-writeblock devices
Snapshotting filesystems
Provisioning SuperfastSupercheap
FastCheap
FastCheap
Changingsmall files
SuperfastSupercheap
FastCostly
FastCheap
Changinglarge files
Slow (first time)Inefficient (copy-up!)
FastCheap
FastCheap
Diffing Superfast Slow Superfast
Memory usage Efficient Inefficient(at high densities)
Inefficient(but may improve)
Drawbacks Random quirksAUFS not mainline
Higher disk usageGreat performance (except diffing)
ZFS not mainlineBTRFS not as nice
Bottom line Ideal for PAAS and high density things
Dodge Ram 3500 This is the future(Probably!)
Storage options
![Page 21: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/21.jpg)
Alright, I get this.Containers = nimble VMs.
![Page 22: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/22.jpg)
![Page 23: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/23.jpg)
The container metaphor
![Page 24: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/24.jpg)
Problem: shipping goods
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
![Page 25: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/25.jpg)
Solution:the intermodal shipping container
![Page 26: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/26.jpg)
Solved!
![Page 27: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/27.jpg)
Problem: shipping code
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
![Page 28: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/28.jpg)
Solution:the Linux container
![Page 29: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/29.jpg)
Solved!
![Page 30: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/30.jpg)
Separation of concerns:Dave the Developer
● Inside my container:– my code
– my libraries
– my package manager
– my app
– my data
![Page 31: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/31.jpg)
Separation of concerns:Oscar the Ops guy
● Outside the container:– logging
– remote access
– network configuration
– monitoring
![Page 32: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/32.jpg)
![Page 33: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/33.jpg)
Docker-what?The Big Picture
● Open Source engine to commoditize LXC● Using copy-on-write for quick provisioning● Allowing to create and share images● Standard format for containers
(stack of layers; 1 layer = tarball+metadata)● Standard, reproducible way to easily build
trusted images (Dockerfile, Stackbrew...)
![Page 34: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/34.jpg)
One-time setup
● On your servers (Linux)– Packages (Ubuntu, Debian, Fedora, Gentoo, Arch...)
– Single binary install (Golang FTW!)
– Easy provisioning on Rackspace, Digital Ocean, EC2, GCE...
● On your dev env (Linux, OS X, Windows)– Vagrantfile
– boot2docker (25 MB VM image)
– Natively (if you run Linux)
![Page 35: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/35.jpg)
The Docker workflow 1/2
● Work in dev environment(local machine or container)
● Other services (databases etc.) in containers(and behave just like the real thing!)
● Whenever you want to test « for real »:– Build in seconds
– Run instantly
![Page 36: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/36.jpg)
The Docker workflow 2/2
Satisfied with your local build?● Push it to a registry (public or private)● Run it (automatically!) in CI/CD● Run it in production● Happiness!
Something goes wrong? Rollback painlessly!
![Page 37: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/37.jpg)
Authoring imageswith run/commit
![Page 38: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/38.jpg)
1) docker run ubuntu bash
2) apt-get install this and that
3) docker commit <containerid> <imagename>
4) docker run <imagename> bash
5) git clone git://.../mycode
6) pip install -r requirements.txt
7) docker commit <containerid> <imagename>
8) repeat steps 4-7 as necessary
9) docker tag <imagename> <user/image>
10) docker push <user/image>
![Page 39: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/39.jpg)
Authoring imageswith run/commit
● Pros– Convenient, nothing to learn
– Can roll back/forward if needed
● Cons– Manual process
– Iterative changes stack up
– Full rebuilds are boring, error-prone
![Page 40: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/40.jpg)
Authoring imageswith a Dockerfile
![Page 41: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/41.jpg)
FROM ubuntu
RUN apt-get -y updateRUN apt-get install -y g++RUN apt-get install -y erlang-dev erlang-manpages erlang-base-hipe ...RUN apt-get install -y libmozjs185-dev libicu-dev libtool ...RUN apt-get install -y make wget
RUN wget http://.../apache-couchdb-1.3.1.tar.gz | tar -C /tmp -zxf-RUN cd /tmp/apache-couchdb-* && ./configure && make install
RUN printf "[httpd]\nport = 8101\nbind_address = 0.0.0.0" > /usr/local/etc/couchdb/local.d/docker.ini
EXPOSE 8101CMD ["/usr/local/bin/couchdb"]
docker build -t jpetazzo/couchdb .
![Page 42: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/42.jpg)
Authoring imageswith a Dockerfile
● Minimal learning curve● Rebuilds are easy● Caching system makes rebuilds faster● Single file to define the whole environment!
![Page 43: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/43.jpg)
Docker 1.0
● Multi-arch, multi-OS● Stable control API● Stable plugin API ● Resiliency● Signature● Clustering
![Page 44: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/44.jpg)
www.dockercon.com
![Page 45: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/45.jpg)
DockerCon special offer!
● Promo code: docker-google15● 15% discount!● Only for the first 10 people to use it!● While supplies last!● GET IT WHILE IT'S HOT!!!!!!!!!!
![Page 46: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/46.jpg)
www.dockercon.com
docker-google15
![Page 47: Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up](https://reader034.vdocuments.net/reader034/viewer/2022051014/54c6bb614a7959d25a8b456b/html5/thumbnails/47.jpg)
Thank you! Questions?
http://docker.io/
http://docker.com/
@docker
@jpetazzo