Discovering Docker Volume Plugins and Apps using VirtualBox

26
Discovering Docker Volume Plugins and Apps using VirtualBox Clint Kitson * Developer Advocate Leader emccode.github.io

Transcript of Discovering Docker Volume Plugins and Apps using VirtualBox

Discovering+Docker+Volume+Plugins+and+Apps+using+VirtualBox

Clint&Kitson&*&Developer&Advocate&Leader

emccode.github.io

descrip(on

There%are%right%and%wrong%ways%to%use%containers%with%persistent%applica4ons.%Lucky%for%you,%doing%it%the%right%way%is%much%easier%nowadays%with%Docker%Volume%Plugins.%This%talk%will%focus%on%doing%some%basic%educa4on%including%mostly%live%demos%to%show%how%you%can%take%advantage%of%these%new%capabili4es%for%expanding%how%you%leverage%containers.

Agenda

• Docker(Volume(Plugin(overview

• Volume(Plugins(with(VirtualBox(in(ac9on

• Inves9ga9ng(applica9ons(and(running(with(Volume(Plugin

• Thinking(about(availability

• Performing(failAover(of(a(container(to(another(container(host

Situa&on/Problem

• When&I&run&a&persistent&applica1on&in&a&container,&where&does&my&data&get&stored?

• Possibly&a&data&volume

• Possibly&container&volume

• Possibly&an&exis1ng&private&mounted&volume&from&networked&storage

• ..&howto&build&a&snowflake

• Container&hosts&should&be&immutable

Enter&Docker&Extensibility

• Volume

• Network

• Authoriza2on

• Composable8and8sustainable

• Consumed8solely8through8Docker8API

• Up8to8consuming8ecoAsystem8to8leverage8func2onality,8ie.8container8schedulers

What%are%Docker%Volume%Plugins

• Drama&cally*simplifies*external*storage*for*usage*with*containers

• Service*that*runs*alongside*Docker*daemon*receiving*Plugin*requests

• Extensible*storage*orchestra&on

• Lunch*is*ready*at*/var/lib/plugin/volumes/vol1/data

• Serves*requests*for*Volume*Create/Remove/Mount/Unmount/Path

How$do$we$play?

• VirtualBox,can,be,used,similar,to,explore

• VirtualBox,is,popular,and,works,well,on,laptops

• Provides,shared,storage,pla;orm,through,Virtual,Media

• or,GCE,,AWS,EC2,,Openstack,Cinder,,EMC,ScaleIO/XtremIO/Isilon/VMAX

• or,other,Volume,Plugins

• MulIple,container,hosts,(VMs),to,ensure,failover,and,immutability

Typical(Install(and(Configure

• Installcurl -sSL https://dl.bintray.com/emccode/rexray/install | sh -

• /etc/rexray/config.ymlrexray: logLevel: warn storageDrivers: - virtualbox mount: volume: preempt: falsevirtualbox: endpoint: http://10.0.2.2:18083 tls: false volumePath: "/Users/clintonkitson/Repos/vagrant-rexray/Volumes" controllerName: SATA

Super&Simple&Example&using&Vagrant&and&VirtualBox

• Requires

• Vagrant

• VirtualBox25.0.10+

• VBoxManage setproperty websrvauthlibrary null

• vboxwebsrv -H 0.0.0.0 -v -b

Vagrant'example

git clone https://github.com/jonasrosland/vagrant-rexraycd vagrant-rexrayvagrant upvagrant ssh rexray-1

Discover)REX-Ray)and)VirtulBox)on)rexray-1

sudo surexrayrexray volume --helprexray volume lsrexray volume create --volumename=testing --size=1rexray volume mount --volumename=testingls /var/lib/rexray/volumes/testing/datarexray volume unmount --volumename=testingrexray stoprexray start

docker'volume'create'.'rexray.1

docker volumedocker volume create \ --driver=rexray --name=meetup1 --opt=size=2docker volume ls

docker'run'with'busybox

docker run -ti \ --volume-driver=rexray -v meetup1:/meetup1 \ busyboxdf /meetup1touch /meetup1/helloexit

docker'run'to'verify'with'busybox

docker run -ti \ --volume-driver=busybox -v meetup1:/meetup1 \ busyboxls /meetup1exit

docker'run'with'sharing'volume

docker run -tid --name=container1 \ --volume-driver=rexray -v meetup1:/meetup1 busyboxdocker run -ti --volumes-from=container1 busyboxls /meetup1exitdocker exec container1 ls /meetup1docker stop container1

Discovering+Volumes+and+Container+Images

• REX%Ray(Docs(on(Applica2ons

• Dockerfile(includes(a(VOLUME(instruc2on

• VOLUME(["/data"]

• Up(to(container(image(maintainer(to(properly(designate(appropriate(loca2on(of(persistent(data

• Makes(a(container(workload(portable

• Enables(immutable(hosts

Discovering+Apps+and+Volumes+using+postgres

• postgres)on)docker)hub

• Dockerfile)for)postgres)9.5

• VOLUME)/var/lib/postgresql/data

running&postgres&,&internal&data&volume

docker run --name some-postgres \ -e POSTGRES_PASSWORD=mysecretpassword -d \ postgresdocker rm -f some-postgres

running&postgres&,&external&data&volume

docker volume create \ --driver=rexray --name=pdata --opt=size=3docker run --name some-postgres \ -e POSTGRES_PASSWORD=mysecretpassword -d \ --volume-driver=rexray -v pdata:/var/lib/postgresql/data \ postgresls /var/lib/rexray/volumes/pdata/datadocker logs some-postgresexit

try$a$failover$,$on$rexray,2

vagrant ssh rexray-2sudo sudocker run --name some-postgres \ -e POSTGRES_PASSWORD=mysecretpassword -d \ --volume-driver=rexray -v pdata:/var/lib/postgresql/data \ postgres

Thinking'About'Availability

• Always(sharing(isn't(the(answer

• Safety(first(for(ext4/xfs

• Failure(scenarios?

• Container(dies?

• Container(run>me(borks?

• Kernel(problems?

• Host(unresponsive?

• ..(volumes(are(typically(aGached(and(locked(to(hosts

turn%on%volume%mount%pre,emp-on

• vi$/etc/rexray/config.yml

• set$rexray.volume.mount.preempt: true

• rexray$stop

• rexray$start

do#a#failover#+#on#rexray+2

docker run --name some-postgres \ -e POSTGRES_PASSWORD=mysecretpassword -d \ --volume-driver=rexray -v data:/var/lib/postgresql/data \ postgres

Summary

• Volume(plugins(are(great

• Keep(container(hosts(immutable

• Persistent(volumes(can(be(orchestrated(for(containers

• Container(images(with(volumes(specified(are(easy(to(make(persistent

EMC${code}$+$emccode.github.io

• Looking(for(folks(that(are(passionate(about(Containers,(Open(Source,(and(DevOps

• REX?Ray

• RackHD

• mesos?module?dvdi

• OSS(ContribuCon(?(Docker,(Mesos,(others

THANK&YOUemccode.github.io