docker + jelastic - planeetta.fi
Post on 15-Apr-2017
206 Views
Preview:
TRANSCRIPT
Docker + Jelastic
@JussiLindfors
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?
“Mini virtualization”
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.
”
Runs identically across different hosts, when done properly
Portable
Saves resources greatly compared to traditional VM
Lightweight
Possible to scale individual application parts (in same host also)
Scalable
Run containers from images almost instantly
Fast
Demo: Jelastic Drupal
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
“Hard stuff”Data persistencyRunning local development environment is
harder than running productionMulti host deploymentsComing up with conventions what to use
Demo: Jenkins
Docker concepts
Base image → Image (layer) → Container (running image)
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)
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
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
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
Dockerfile / Instructions 2/3ENV
Set environment variableVOLUME
Creates mount point that is located in host or other container
EXPOSEExposes port(s) from the container
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
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
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
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
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
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
Questions?
Thank you!
@JussiLindfors
top related