Introduction to Docker2015-09-10
Jonatan Bjork DevOps Engineer @jonatanblue
(and your company, Reqiva)
What is Docker?An open-source project that automates the deployment
of applications inside software containers
Sounds a lot like VM to me
VM hypervisors (such as Hyper-V, KVM, and Xen) are all based on emulating hardware. That makes them fat in terms of system requirements.
Containers use shared operating systems. Instead of virtualising hardware, containers rest on top of a single Linux instance.
Why do we like that?
When using containers you can leave behind the useless 99.9% VM junk, leaving you with a small,
neat capsule containing your application.
I dont need DockerI can do all that stuff with LXC tools, rsync + some
true on all accounts
but it's also true for apt, dpkg, rpm, yum,
the whole point is to commoditise
to make it ridiculously easy to use
What is Doxford?
Docker Oxford is a place to learn about Docker and containers.
We are developers, sysadmins and ops and software engineers, working with containers to build and deliver better software.
Im ready to try it!
# curl do_you_trust_me.sh | bash
# apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D # echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list# apt-get update # apt-get purge lxc-docker*# apt-get install docker-engine
Docker on your machine Docker client - CLI you issue commands to Docker daemon - Service running in the
background, responsible for pulling images, running containers and streaming input/output from/to the client
Images & Containers Image
An ordered collection of root filesystem changes - typically a union of layered filesystems stacked on top of each other. Images are read only.
Container A container is a runtime instance of a docker image. Consists of: - A Docker image - Execution environment - A standard set of instructions
Building an image Dockerfile - a text document that contains all the
commands you would normally execute manually in order to build a Docker image
Building an image
Committing an imageIf you make changes to a container, you can commit those changes by creating a new image from that state!
Shipping an image Locally - you can build the image on the same
machine as you run it on. That way the image is instantly accessible after its been built.
Registry - the more scalable way to ship images is to use a registry - its basically a third machine that acts as an image store. You build the image on one machine, push it to the registry, and pull it down to all other machines that want to run containers from that image. The most famous registry is hub.docker.com
Shipping an image: locally
Shipping an image: tar
Shipping an image: registry
Live recorded demo.
Docker Hack Day Anything Docker-related Submit idea + find a team (we can help you do
that) Join us at the Hatch on Saturday 19th September
for a day of coding Details on the Meetup page
Requests Docker cases in production Drone for continuous integration Anyone using Registry? Nope. Can you use AutoScaling with Docker?
- James Bottomley explains the difference between containers vs. VMs really well.
- Docker glossary explains everything: http://docs.docker.com/reference/glossary/
- Matt Jaynes (@nanobeep on Twitter) provides excellent guidance in combating complexity
Q&A Whats the benefit of using -v over committing everything to the image? > -v
allows you to from the host share SSL certs, passwords, things you (may) want to change independently of your container anything you need to get out to
make the container stateless. You can use format when doing docker inspect Production use case 1: On AWS with RDS (postgres), ElasticSearch, Nginx
using Docker Compose (a YAML file that describes links between containers) Production use case 2: RESTful API spawning containers for processing videos Can you link multiple containers? > Yes, with Compose RancherOS dockerised version of Linux Dokku - Heroku in a box Openshift - Runs SELinux Mesos post article with diff Kubernetes If you have to log in to a container and change stuff youre probably doing it
wrong Docker newsletter is useful
Ideas for future talks. Using Docker as a provider for Vagrant Docker Compose, Swarm and Machine Docker good ideas and misconceptions Docker security (sharing machines, verifying images,
patching) Logging and monitoring Docker platform as a service
Please contact us if you want to give a talk on any of these topics! meetup.com/docker-oxford