docker + jelastic - planeetta.fi
TRANSCRIPT
![Page 1: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/1.jpg)
Docker + Jelastic
![Page 2: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/2.jpg)
@JussiLindfors
![Page 3: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/3.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/4.jpg)
“Mini virtualization”
![Page 5: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/5.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/6.jpg)
Runs identically across different hosts, when done properly
Portable
![Page 7: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/7.jpg)
Saves resources greatly compared to traditional VM
Lightweight
![Page 8: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/8.jpg)
Possible to scale individual application parts (in same host also)
Scalable
![Page 9: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/9.jpg)
Run containers from images almost instantly
Fast
![Page 10: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/10.jpg)
Demo: Jelastic Drupal
![Page 11: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/12.jpg)
“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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/13.jpg)
Demo: Jenkins
![Page 14: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/14.jpg)
Docker concepts
![Page 15: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/15.jpg)
Base image → Image (layer) → Container (running image)
![Page 16: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/18.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/19.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/21.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/22.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/23.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/24.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/25.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/26.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/27.jpg)
Questions?
![Page 28: Docker + Jelastic - planeetta.fi](https://reader036.vdocuments.net/reader036/viewer/2022081521/587c6a561a28ab633c8b7967/html5/thumbnails/28.jpg)
Thank you!
@JussiLindfors