introduction to docker

27
R.I.Pienaar Malta DevOps September 2016 Introduction to Docker

Upload: ripienaar

Post on 16-Apr-2017

60 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Introduction to Docker

R.I.Pienaar

Malta DevOps September 2016

Introduction to Docker

Page 2: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Who am I?• Malta since December 2015

• Consultant for 20+ years

• Government, Finance, Health, Social Media, Fortune 50, Startups

• DevOps, Automation, Architect, Development

• Open Source @ github.com/ripienaar

• Linux since Kernel 99 alpha p11

Page 3: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Multi Purpose

Page 4: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Multi Purpose Servers

Page 5: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Standardised

Page 6: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Standardised

Page 7: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Remain Diverse

Page 8: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Standard

Page 9: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Page 10: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Build

Store

RunDeploy

Monitor

Measure Discover

Manage

Page 11: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Building - Dockerfile

FROM ubuntu MAINTAINER R.I.Pienaar <[email protected]>

RUN apt-get -y update && \ apt-get -y install fortunes cowsay

CMD /usr/games/fortune -a | /usr/games/cowsay

Page 12: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Building - Dockerfile$ docker build —tag cowsay . Sending build context to Docker daemon 2.048 kB Step 1 : FROM ubuntu latest: Pulling from library/ubuntu … Step 2 : MAINTAINER R.I.Pienaar <[email protected]> ---> bfed29b12e38 Step 3 : RUN apt-get -y update && apt-get -y install fortunes cowsay ---> 84f9c78e6ea7 … Removing intermediate container e92ea7c080b6 Successfully built ddf94ac97d92

Page 13: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Running an Image

$ docker run —rm cowsay ________________________________________ / I'd rather just believe that it's done \ \ by little elves running around. / ---------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Page 14: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Storing an Image

$ docker tag 0efcb77c2e86 quay.io/ripienaar/cowsay $ docker push quay.io/ripienaar/cowsay The push refers to a repository [quay.io/ripienaar/cowsay] 4d01acd487b1: Pushed 0cad5e07ba33: Pushed 48373480614b: Pushed 055757a19384: Pushed c6f2b330b60c: Pushed c8a75145fcc4: Pushed latest: digest: sha256:43adc5…155b8d0a195171 size: 7119

Page 15: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Inheriting from an ImageFROM quay.io/ripienaar/cowsay MAINTAINER R.I.Pienaar <[email protected]>

CMD /usr/games/fortune -a | /usr/games/cowsay -f /usr/share/cowsay/cows/tux.cow

$ docker build —tag quay.io/ripienaar/tuxsay . $ docker push quay.io/ripienaar/tuxsay

Page 16: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Running an Image$ docker run —rm quay.io/ripienaar/tuxsay ____________________________ < Steal this tagline. I did. > ---------------------------- \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/

Page 17: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Efficient ubuntu:latest

cowsay

MAINTAINER:

apt-get install

MAINTAINER:

tuxsay

86.7 MB

0 MB

Page 18: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Running - API

require “docker”

container = Docker::Container.create( “Image” => “quay.io/ripienaar/tuxsay” )

container.start puts container.attach container.stop container.delete

Page 19: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Running - API

$ ruby tuxsay.rb __________________ < I've Been Moved! > ------------------ \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/

Page 20: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Observing - APIrequire “docker”

Docker::Event.stream do |event| puts event end

Docker::Event { container create (image=quay.io/ripienaar/tuxsay, name=jovial_galileo) }

Docker::Event { container die (exitCode=0, image=quay.io/ripienaar/tuxsay, name=jovial_galileo) }

Page 21: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Platform for Devs and Ops

Page 22: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Page 23: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

http://gliderlabs.com/registrator/

Demo

Page 24: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Weather Service

Page 25: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

https://www.dockerbook.com/

Page 26: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Linkshttp://docker.com/https://12factor.net/

http://label-schema.org/

https://github.com/ripienaar/mt_devops_sept2016

https://github.com/ripienaar/weather-demo

Page 27: Introduction to Docker

R.I.Pienaar | [email protected] | http://devco.net | @ripienaar

Questions?

twitter: @ripienaaremail: [email protected]: www.devco.net

github: ripienaarfreenode: Volcane

slack.puppet.com: ripienaar

https://www.devco.net/