Docker 1.9 Workshop

Post on 15-Apr-2017

552 views 0 download

Transcript of Docker 1.9 Workshop

Docker "102" TrainingPresented by and

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

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)

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

Delivery)· Scaleabe and Dense

· Community (OSS, GitHub)· Ecosystem

· Security, Orchestration, Networking & Storage

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

· Operator: Configure Once, Run Anything

Docker Platform

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

Docker Registry· Application dedicated to the

storage and distribution of your Docker images

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

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

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.

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

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

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.

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

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.

Data Persistence

Today's Apps Favor:· stateless applications

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

Persistence last year #1

database lives outside of a container

Persistence last year #2

based on object stores

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

block/nas host mounts

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

busybox

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

ELI5

REX-Raya volume plugin which is

written in Go and provides advanced storage

functionality for various platforms

https://github.com/emccode/rexray

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.

Lab V: Networking Between Container Hosts