docker + jelastic - planeetta.fi

28
Docker + Jelastic

Upload: jussi-lindfors

Post on 15-Apr-2017

206 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Docker + Jelastic - planeetta.fi

Docker + Jelastic

Page 2: Docker + Jelastic - planeetta.fi

@JussiLindfors

Page 3: Docker + Jelastic - planeetta.fi

Just had 2nd birthday!Huge momentum in open source community

Docker is also adopted by the biggest players in cloud / saas providers

Supported by Linux distributionsWindows driver in developmentOS X still requires VM to run Docker

Docker?

Page 4: Docker + Jelastic - planeetta.fi

“Mini virtualization”

Page 5: Docker + Jelastic - planeetta.fi

The Docker Engine container comprises just the application and its dependencies. It runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers. Thus, it enjoys the resource isolation and allocation benefits of VMs but is much more portable and efficient.

Page 6: Docker + Jelastic - planeetta.fi

Runs identically across different hosts, when done properly

Portable

Page 7: Docker + Jelastic - planeetta.fi

Saves resources greatly compared to traditional VM

Lightweight

Page 8: Docker + Jelastic - planeetta.fi

Possible to scale individual application parts (in same host also)

Scalable

Page 9: Docker + Jelastic - planeetta.fi

Run containers from images almost instantly

Fast

Page 10: Docker + Jelastic - planeetta.fi

Demo: Jelastic Drupal

Page 11: Docker + Jelastic - planeetta.fi

BenefitsPlatform that consists of individual services

keeps your application architecture flexibleChanging and testing part of the app is faster

than recreating whole platformReusability of images makes future

applications faster to buildScaling parts of the application is easier

Page 12: Docker + Jelastic - planeetta.fi

“Hard stuff”Data persistencyRunning local development environment is

harder than running productionMulti host deploymentsComing up with conventions what to use

Page 13: Docker + Jelastic - planeetta.fi

Demo: Jenkins

Page 14: Docker + Jelastic - planeetta.fi

Docker concepts

Page 15: Docker + Jelastic - planeetta.fi

Base image → Image (layer) → Container (running image)

Page 16: Docker + Jelastic - planeetta.fi

ImagesImages forms chain of layers towards base imageImage (layer)

Read-only, newer changesReferences parent image

Images are build on top of other imagesOnly changes towards parent image is stored

Base imageFirst image next to kernel (ie. ubuntu)

Page 17: Docker + Jelastic - planeetta.fi

Creating imagesInteractively

MANUALInstalling software and

configs through shellCommitting changesFor: playing around and

testing out stuff

DockerfileSCRIPTEDSimple syntax that gives

builder instructionsFor: really creating an app

Page 18: Docker + Jelastic - planeetta.fi

DockerfileBy scripting image creation, we can be sure

that there is nothing extra in images we useSyntax is really simple and only offers handful

of instructions to useEach instruction that is ran in build process is

cached into intermediate containersThis will speed up image building

Page 19: Docker + Jelastic - planeetta.fi

Dockerfile / Instructions 1/3FROM

Required as first non-comment instructionCan be any image repository

MAINTAINERADD

Adds files and folders into image from contextRUN

Executes command(s) in a new layerie. apt-get install stuff

Page 20: Docker + Jelastic - planeetta.fi

Dockerfile / Instructions 2/3ENV

Set environment variableVOLUME

Creates mount point that is located in host or other container

EXPOSEExposes port(s) from the container

Page 21: Docker + Jelastic - planeetta.fi

Dockerfile / Instructions 3/3ENTRYPOINT

Actual command that is run, uses CMD as argumentCannot be overwritten in: docker runDefaults to: /bin/sh -c

CMDDefault command to run in a containerCan be overwritten in: docker runIe. running /bin/bash is actually ENTRYPOINT

argument that translates into: /bin/sh -c /bin/bash

Page 22: Docker + Jelastic - planeetta.fi

RepositoryBy committing image, it will become an

repository<repository>:<tag> ie. ubuntu:14.04

You can tag images in repository, which is like having git branches

Page 23: Docker + Jelastic - planeetta.fi

RegistryRegistry contains docker repositoriesThere is always local registry where built or

committed images are savedAlso there is public registry that is hosted by

Docker, which is called Docker Hubhttps://registry.hub.docker.com/

You can host your own private registry

Page 24: Docker + Jelastic - planeetta.fi

ContainerContainer is an read-write layer that is added

on top of the image it is ran fromContainer executes given command / process

and when it’s done - containers active state stops

Each container gets IP from docker private network and can talk to the host, other containers

Page 25: Docker + Jelastic - planeetta.fi

ContainerLinked container can access other containers

env variables and networkContainer volumes can be used within other

containersYou can limit cpu and memory for each

container

Page 26: Docker + Jelastic - planeetta.fi

Resourceshttps://www.digitalocean.com/community/tutorials/the-docker-ecosystem-an-introduction-to-common-componentshttps://docs.docker.com/introduction/understanding-docker/http://www.mindmeister.com/389671722/docker-ecosystem

List of projects related to Dockerhttp://www.centurylinklabs.com/what-is-docker-and-when-to-use-it/http://progrium.com/blog/

Lots of cool stuff, check out the github alsohttp://www.centurylinklabs.com/optimizing-docker-images/https://crosbymichael.com/dockerfile-best-practices.html

Page 27: Docker + Jelastic - planeetta.fi

Questions?

Page 28: Docker + Jelastic - planeetta.fi

Thank you!

@JussiLindfors