Docker 1.9 Workshop

36
Docker "102" Training Presented by and

Transcript of Docker 1.9 Workshop

Page 1: Docker 1.9 Workshop

Docker "102" TrainingPresented by and

Page 2: Docker 1.9 Workshop
Page 4: Docker 1.9 Workshop

Docker Stats· 25,000+ GitHub Stars

· 425M+ Docker Engine Downloads· 100,000+ "Dockerized" applications Docker Hub

· 180+ Docker Meetup Groups in 50 Countries· 950+ Community Contributers

· 50,000 3rd Party projects on GitHub using Docker in PaaS, OS, CI, and more

Page 5: Docker 1.9 Workshop

Why Docker?· Works Everywhere (multi-arch, multi-OS, any

cloud)· Work for Everyone (dev, ops, & devops)

· Isolation (Cgroups, Namespaces)· Lightweight (Binary, Dockerfile)· Simplicity (Layers, Dockerfile)

Page 6: Docker 1.9 Workshop

Why Docker?· Workflow (CI, Distributed Architecture, Faster

Delivery)· Scaleabe and Dense

· Community (OSS, GitHub)· Ecosystem

· Security, Orchestration, Networking & Storage

Page 7: Docker 1.9 Workshop

Why It Makes Sense?· Developer: Build Once, Run Anywhere

· Operator: Configure Once, Run Anything

Page 8: Docker 1.9 Workshop
Page 9: Docker 1.9 Workshop
Page 10: Docker 1.9 Workshop

Docker Platform

Page 11: Docker 1.9 Workshop

Docker Engine· Runs on Linux to create the

operating environment for your distributed

applications. The in-host daemon communicates with the Docker client to execute

commands to build, ship and run containers.

docker run -tid busybox

Page 12: Docker 1.9 Workshop

Docker Registry· Application dedicated to the

storage and distribution of your Docker images

Page 13: Docker 1.9 Workshop

Docker Hub

· A cloud hosted service from Docker that provides registry

capabilities for public and private content. Easily

collaborate effortlessly with the broader Docker

community or within your team on key content, or

automate your application building workflows

Page 14: Docker 1.9 Workshop

Docker Machine· A tool to simplify the

automatic creation, configuration, and

management of Docker-enabled machines, whether they are VMs running locally

in Virtualbox or in a cloud provider such as Amazon

Web Servicesdocker-machine create --driver virtualbox

dev

Page 15: Docker 1.9 Workshop

Lab I: Run Your First Containerhttps://github.com/emccode/training/tree/master/docker-workshop/websummit

In this lab you'll learn use Docker, how to search for Docker images on Docker hub, and how to run

your images and connect to the applications inside them.

Page 16: Docker 1.9 Workshop

Docker CLI- docker build #Build an image from a Dockerfile - docker images #List all images on a Docker host- docker run #Run an image- docker ps #List all running instances- docker stop #Stop a running instance- docker rm #Remove an instance- docker rmi #Remove an image from Docker host

Page 17: Docker 1.9 Workshop

Docker Compose· Instead of having to build,

run and manage each individual container for a distributed application,

Docker Compose allows you to define your multi-

container application with all of its dependencies in a

single file, then spin your application up in a single

command.docker-compose up -d

Page 18: Docker 1.9 Workshop

Lab II: Create A Compose Filehttps://github.com/emccode/training/tree/master/docker-workshop/websummit

Programmatically deploy an application with code and use a Dockerfile. A Dockerfile is a text

document that contains all the commands a user could call on the command line to assemble an

image. Compose is a tool for defining and running multi-container applications.

Page 19: Docker 1.9 Workshop

Docker Swarm· Provides native clustering

capabilities to turn a group of Docker engines into a single, virtual Docker Engine. With these pooled resources, you

can scale out your application as if it were

running on a single, huge computer

Page 20: Docker 1.9 Workshop

Lab III: Create A Swarm Clusterhttps://github.com/emccode/training/tree/master/docker-workshop/websummit

In this lab you'll setup a Docker Swarm cluster. Docker Swarm serves the standard Docker API,

any tool that already communicates with a Docker daemon can use Swarm to transparently

scale to multiple hosts.

Page 21: Docker 1.9 Workshop

Data Persistence

Page 22: Docker 1.9 Workshop

Today's Apps Favor:· stateless applications

· non-persistent data· services (load balancers, routing, queuing, etc)

Page 23: Docker 1.9 Workshop

Persistence last year #1

database lives outside of a container

Page 24: Docker 1.9 Workshop

Persistence last year #2

based on object stores

Page 25: Docker 1.9 Workshop

Docker Data Volumesa directory with one or more containers that

bypasses the Union File System

- initialized during container creation- volumes can be shared amongst containers- changes to data volumes are made directly- changes will not be included during image update- volumes persist after container is deleted

Page 26: Docker 1.9 Workshop

block/nas host mounts

$ docker run -i -t -v nfs/host/mount/path:/container/folder/path

busybox

Page 27: Docker 1.9 Workshop

Docker Volume Driver· introduced in 1.7 Experimental

· merged into master in 1.8 #14659· allows third-party container data management solutions to provide data volumes for containers

which operate on data, such as databases, queues and key-value stores and other stateful

applications that use the filesystem

Page 28: Docker 1.9 Workshop

ELI5

Page 29: Docker 1.9 Workshop
Page 30: Docker 1.9 Workshop
Page 31: Docker 1.9 Workshop
Page 32: Docker 1.9 Workshop
Page 33: Docker 1.9 Workshop
Page 34: Docker 1.9 Workshop

REX-Raya volume plugin which is

written in Go and provides advanced storage

functionality for various platforms

https://github.com/emccode/rexray

Page 35: Docker 1.9 Workshop

Lab IV: Container Persistencehttps://github.com/emccode/training/tree/master/docker-workshop/websummit

Unlike using virtual machines, containers require that data that must be stored (or persisted)

outside of the container itself. A primary reason behind this is that Docker containers are not

immediately portable between hosts. Data must be persisted outside of the container.

Page 36: Docker 1.9 Workshop

Lab V: Networking Between Container Hosts