SlideShare a Scribd company logo
Docker for (java-)devs
How Vimond handles the Docker hype
Why
It makes the life of devs and ops easier
if you do things right…
And to do that you must understand how it
works.
Image vs container
illustration from http://docs.docker.com/terms/container/
Image vs container
• an image is the blueprint for the container
• a container is an instance of the image
• the container is writeable, while an image is not
(after creation)
• the container state can be committed to form an
image
Base images
Choosing a base image
• They come in all sizes, for specialised or general
purposes.
• Majority based on some version of Ubuntu, but
many are also small (of size in MB) with a limited
toolset.
Choosing a base image
This is one of the questions dividing the community
into two camps:
Should my container run one process, or many?
my process as PID 1
vs
using an init process?
Images inheritance
phusion/baseimage:0.9.16
vimond/vimond-base
vimond/micros-base
vimond/gatekeeper vimond/eventservice vimond/< micros >vimond/< micros >vimond/< micros >
Tags / Versions
• Use some time to think through Docker tagging
• Tag is normally a version, but don’t need to be
• Special tag “latest” appended if no tag specified
• Metadata is a new feature - might change the scenarios
where tags was used earlier. Have not looked into it yet.
The Dockerfile
Dissecting a Dockerfile
FROM phusion/baseimage:0.9.16



# Set correct environment variables.

ENV HOME /root



# Regenerate SSH host keys.
# You may also comment out this instruction; the

# init system will auto-generate one during boot.

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh



# Use baseimage-docker's init system.

CMD ["/sbin/my_init"]



# ...put your own build instructions here...



#RUN apt-get update && apt-get -y upgrade



# Clean up APT when done.

#RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Dissecting a Dockerfile
FROM vimond.artifactoryonline.com/vimond-base



# automatically accept oracle license

RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true 

| /usr/bin/debconf-set-selections



RUN add-apt-repository ppa:webupd8team/java 

&& apt-get update 

&& apt-get -y upgrade 

&& apt-get -y install 

oracle-java8-set-default 

oracle-java8-unlimited-jce-policy 

oracle-java8-installer  

libsnappy-java 

python-software-properties 



# Clean up APT when done.

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*



ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

Dissecting a Dockerfile
# vim:set ft=dockerfile:

FROM vimond.artifactoryonline.com/vimond-base-java-8

MAINTAINER Olve Sæther Hansen <olve@vimond.com>



# Set correct environment variables.

ENV HOME /root



# Regenerate SSH host keys. baseimage-docker does not contain any, so you

# have to do that yourself. You may also comment out this instruction; the

# init system will auto-generate one during boot.

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh



# Use baseimage-docker's init system.

CMD ["/sbin/my_init"]





# automatically accept oracle license

#RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true 

# | /usr/bin/debconf-set-selections





RUN apt-get update 

&& apt-get -y upgrade 

&& apt-get -y install 

python-pip 

&& apt-get clean 

&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN pip install cqlsh







#Swaps (ubuntu) dash with bash for easier sourceing

RUN rm /bin/sh && ln -s /bin/bash /bin/sh



COPY docker-service.sh /tmp/docker-service.sh

COPY docker-service-startup-command.sh /etc/my_init.d/docker-service-startup-command.sh

RUN chmod a+x /etc/my_init.d/docker-service-startup-command.sh

ONBUILD COPY docker/docker-config.yml docker/docker.properties build/libs/*.jar target/*.jar /tmp/

ONBUILD RUN rm -fv /tmp/*tests*.jar





#Notes on variables below. $UPPER_CASE means variables to be evaluated at runtime, all file names in

#/etc/container_environment will be a variable name with the file content as value.

#Variables with $lower_case means the var should used only in the Dockerfile image build phase.

#This is for keeping the confusion at bay.

ONBUILD RUN source /tmp/docker.properties 

&& useradd -ms /bin/bash -d /opt/$service_name -G docker_env $service_name 

&& mkdir /var/log/${service_name} 

&& mkdir /etc/service/${service_name} 

&& mv /tmp/docker-service.sh /etc/service/$service_name/run 

&& echo $service_name >> /etc/container_environment/SERVICE_NAME 
[snip]

Dissecting a Dockerfile
FROM vimond.artifactoryonline.com/micros-baseimage



MAINTAINER Olve Sæther Hansen <olve@vimond.com>



EXPOSE 18080

EXPOSE 18081



ENV SERVICE_18080_NAME eventservice_backends

ENV SERVICE_18081_NAME eventservice_admin

ENV SERVICE_9010_NAME eventservice_jmx

ENV SERVICE_18080_CHECK_HTTP /version

ENV SERVICE_18080_CHECK_INTERVAL 15s

ENV SERVICE_18081_CHECK_HTTP /healthcheck

ENV SERVICE_18081_CHECK_INTERVAL 15s

ENV SERVICE_18080_TAGS "haproxy_lb_http,public,service,haproxy_backend"

ENV SERVICE_18081_TAGS "admin_http_no_lb,private,haproxy_backend"

ENV SERVICE_9010_TAGS "tcp,private"

Ways of building images
• Image from direct container changes
• Dynamic Dockerfile
• Static Dockerfile
Things to think about
• size of image (.dockerignore)
• compile inside or outside of image?
• what to do about secrets?
• what do do about dependencies
• what to do about access to dependencies (repos)
• (sure I forgot something - anyone?)
Lets build some
images
When your image is
built, where should it go?
hub.docker.com
• the GitHub for Docker
• IMO best for public images, as rights
management and building can be cumbersome
for private repositories
hub.<yoursite>.com
• The registry is open source, so it is possible to
run it locally
• Have not tried this - might be a sound solution
<yoursite>.artifactoryonline.com
• We went for this solution, as we already store our
jar-files, npm builds and gems in Artifactory.
• Some other nice features for image promotion
• Probable other solutions, both onsite or as a
service in this space
Volumes
Mounted Volumes
• Mount files or folders from host to the container in RO or
RW mode.
• Useful for
• static data,
• complex configurations
• getting logs out of the container
• any dynamic data created in container that you want to
keep
Data Volume Container
• Data volumes can be created from scratch or from
a docker container which has a volume.
• use “—volume-from” command when starting/
creating other container
• useful for dynamic data that can be versioned,
shared and used in different environments
(e.g. databases)
What is going on inside a
container
• Can be a bit cumbersome, but possible to
introspect in many ways.
• top (processes are exposed to host)
• ssh (if ssh server enabled- re multiple processes)
• docker exec -t -i <container id> bash -l
• docker inspect <container id>
Enough already, can't
we just fire them up?
Docker Compose
• previously known as fig
• Tool for setting up several containers linked
together.
• Handled by a single configuration
• We use it to set up infrastructure and perform
integration tests
Putting everything
together
Configuration
Configuration
• use production optimised defaults
• use a sane convention and override when needed
• make configuration expressible via system
variables when possible
(meaning no lists, maps etc)
Discovery
Discovery
• Keep service discovery out of the service
• Keep service discovery out of the image containing
the service
• Use Docker events and have a dedicated
discovery agent running and reporting
Routing
Routing
• We have now many services/containers running, each on
a random port on different machines.
• How do we route traffic to and from?
• Docker Compose can help (also in prod systems)
• We decided to write HAProxy configs on the fly based on
Docker events (via a service discovery system - Consul
and Registrator)
• Consul-template reacts to events in consul, and rewrites
configuration files
HAProxy service routing
• Typically two HAProxy servers with identical configuration
• One front-end on port 80 that selects backend based on DNS
• One backend for each service
• Many load balanced servers (potentially) for each backend
• Service outage will rewrite configuration file and restart
HAProxy
• Service additions will rewrite configuration file and restart
HAProxy
Other interesting Docker
tools and notes
• Docker Machine
• Docker Swarm
• ECS from Amazon
• https://github.com/gliderlabs/logspout
• https://github.com/GoogleCloudPlatform/kubernetes
• Many others, but difficult to separate hype from
promising projects.
?

More Related Content

What's hot

Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
Larry Cai
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet tree
Julien Pivotto
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
Roman Rodomansky
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
Chef Software, Inc.
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Walter Heck
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
Joshua Thijssen
 
Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709
Tianwei Liu
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
CodeOps Technologies LLP
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
Michele Orselli
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
Patrick Kleindienst
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
Tim Riley
 
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Stephane Manciot
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
Geeta Vinnakota
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
Soshi Nemoto
 
Getting Started with Docker
Getting Started with Docker Getting Started with Docker
Getting Started with Docker
Anup Segu
 
douban happyday docker for daeqaci
douban happyday docker for daeqacidouban happyday docker for daeqaci
douban happyday docker for daeqaci
Tianwei Liu
 

What's hot (20)

Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet tree
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
Getting Started with Docker
Getting Started with Docker Getting Started with Docker
Getting Started with Docker
 
douban happyday docker for daeqaci
douban happyday docker for daeqacidouban happyday docker for daeqaci
douban happyday docker for daeqaci
 

Similar to Docker presentasjon java bin

Docker introduction
Docker introductionDocker introduction
Docker introduction
Jo Ee Liew
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
Arun prasath
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
nklmish
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
Dmitry Lyfar
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
Giacomo Vacca
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
Jeffrey Ellin
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
Word press, the automated way
Word press, the automated wayWord press, the automated way
Word press, the automated way
Michaël Perrin
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
Liang Bo
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
Sencha
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
Chris Tankersley
 
Kubernetes @ meetic
Kubernetes @ meeticKubernetes @ meetic
Kubernetes @ meetic
Sébastien Le Gall
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
Fabio Fumarola
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptx
Vipobav
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and DockerWebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
David Currie
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
Vincent Mercier
 
Was liberty profile and docker
Was liberty profile and dockerWas liberty profile and docker
Was liberty profile and dockersflynn073
 
Docker and-daily-devops
Docker and-daily-devopsDocker and-daily-devops
Docker and-daily-devops
Satria Ady Pradana
 

Similar to Docker presentasjon java bin (20)

Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Word press, the automated way
Word press, the automated wayWord press, the automated way
Word press, the automated way
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
Kubernetes @ meetic
Kubernetes @ meeticKubernetes @ meetic
Kubernetes @ meetic
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptx
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and DockerWebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
Was liberty profile and docker
Was liberty profile and dockerWas liberty profile and docker
Was liberty profile and docker
 
Docker and-daily-devops
Docker and-daily-devopsDocker and-daily-devops
Docker and-daily-devops
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Docker presentasjon java bin

  • 1. Docker for (java-)devs How Vimond handles the Docker hype
  • 2. Why It makes the life of devs and ops easier if you do things right… And to do that you must understand how it works.
  • 3. Image vs container illustration from http://docs.docker.com/terms/container/
  • 4. Image vs container • an image is the blueprint for the container • a container is an instance of the image • the container is writeable, while an image is not (after creation) • the container state can be committed to form an image
  • 6. Choosing a base image • They come in all sizes, for specialised or general purposes. • Majority based on some version of Ubuntu, but many are also small (of size in MB) with a limited toolset.
  • 7. Choosing a base image This is one of the questions dividing the community into two camps: Should my container run one process, or many? my process as PID 1 vs using an init process?
  • 9. Tags / Versions • Use some time to think through Docker tagging • Tag is normally a version, but don’t need to be • Special tag “latest” appended if no tag specified • Metadata is a new feature - might change the scenarios where tags was used earlier. Have not looked into it yet.
  • 11. Dissecting a Dockerfile FROM phusion/baseimage:0.9.16
 
 # Set correct environment variables.
 ENV HOME /root
 
 # Regenerate SSH host keys. # You may also comment out this instruction; the
 # init system will auto-generate one during boot.
 RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
 
 # Use baseimage-docker's init system.
 CMD ["/sbin/my_init"]
 
 # ...put your own build instructions here...
 
 #RUN apt-get update && apt-get -y upgrade
 
 # Clean up APT when done.
 #RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  • 12. Dissecting a Dockerfile FROM vimond.artifactoryonline.com/vimond-base
 
 # automatically accept oracle license
 RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true 
 | /usr/bin/debconf-set-selections
 
 RUN add-apt-repository ppa:webupd8team/java 
 && apt-get update 
 && apt-get -y upgrade 
 && apt-get -y install 
 oracle-java8-set-default 
 oracle-java8-unlimited-jce-policy 
 oracle-java8-installer 
 libsnappy-java 
 python-software-properties 
 
 # Clean up APT when done.
 RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
 ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

  • 13. Dissecting a Dockerfile # vim:set ft=dockerfile:
 FROM vimond.artifactoryonline.com/vimond-base-java-8
 MAINTAINER Olve Sæther Hansen <olve@vimond.com>
 
 # Set correct environment variables.
 ENV HOME /root
 
 # Regenerate SSH host keys. baseimage-docker does not contain any, so you
 # have to do that yourself. You may also comment out this instruction; the
 # init system will auto-generate one during boot.
 RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
 
 # Use baseimage-docker's init system.
 CMD ["/sbin/my_init"]
 
 
 # automatically accept oracle license
 #RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true 
 # | /usr/bin/debconf-set-selections
 
 
 RUN apt-get update 
 && apt-get -y upgrade 
 && apt-get -y install 
 python-pip 
 && apt-get clean 
 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 RUN pip install cqlsh
 
 
 
 #Swaps (ubuntu) dash with bash for easier sourceing
 RUN rm /bin/sh && ln -s /bin/bash /bin/sh
 
 COPY docker-service.sh /tmp/docker-service.sh
 COPY docker-service-startup-command.sh /etc/my_init.d/docker-service-startup-command.sh
 RUN chmod a+x /etc/my_init.d/docker-service-startup-command.sh
 ONBUILD COPY docker/docker-config.yml docker/docker.properties build/libs/*.jar target/*.jar /tmp/
 ONBUILD RUN rm -fv /tmp/*tests*.jar
 
 
 #Notes on variables below. $UPPER_CASE means variables to be evaluated at runtime, all file names in
 #/etc/container_environment will be a variable name with the file content as value.
 #Variables with $lower_case means the var should used only in the Dockerfile image build phase.
 #This is for keeping the confusion at bay.
 ONBUILD RUN source /tmp/docker.properties 
 && useradd -ms /bin/bash -d /opt/$service_name -G docker_env $service_name 
 && mkdir /var/log/${service_name} 
 && mkdir /etc/service/${service_name} 
 && mv /tmp/docker-service.sh /etc/service/$service_name/run 
 && echo $service_name >> /etc/container_environment/SERVICE_NAME [snip]

  • 14. Dissecting a Dockerfile FROM vimond.artifactoryonline.com/micros-baseimage
 
 MAINTAINER Olve Sæther Hansen <olve@vimond.com>
 
 EXPOSE 18080
 EXPOSE 18081
 
 ENV SERVICE_18080_NAME eventservice_backends
 ENV SERVICE_18081_NAME eventservice_admin
 ENV SERVICE_9010_NAME eventservice_jmx
 ENV SERVICE_18080_CHECK_HTTP /version
 ENV SERVICE_18080_CHECK_INTERVAL 15s
 ENV SERVICE_18081_CHECK_HTTP /healthcheck
 ENV SERVICE_18081_CHECK_INTERVAL 15s
 ENV SERVICE_18080_TAGS "haproxy_lb_http,public,service,haproxy_backend"
 ENV SERVICE_18081_TAGS "admin_http_no_lb,private,haproxy_backend"
 ENV SERVICE_9010_TAGS "tcp,private"

  • 15. Ways of building images • Image from direct container changes • Dynamic Dockerfile • Static Dockerfile
  • 16. Things to think about • size of image (.dockerignore) • compile inside or outside of image? • what to do about secrets? • what do do about dependencies • what to do about access to dependencies (repos) • (sure I forgot something - anyone?)
  • 18. When your image is built, where should it go?
  • 19. hub.docker.com • the GitHub for Docker • IMO best for public images, as rights management and building can be cumbersome for private repositories
  • 20. hub.<yoursite>.com • The registry is open source, so it is possible to run it locally • Have not tried this - might be a sound solution
  • 21. <yoursite>.artifactoryonline.com • We went for this solution, as we already store our jar-files, npm builds and gems in Artifactory. • Some other nice features for image promotion • Probable other solutions, both onsite or as a service in this space
  • 23. Mounted Volumes • Mount files or folders from host to the container in RO or RW mode. • Useful for • static data, • complex configurations • getting logs out of the container • any dynamic data created in container that you want to keep
  • 24. Data Volume Container • Data volumes can be created from scratch or from a docker container which has a volume. • use “—volume-from” command when starting/ creating other container • useful for dynamic data that can be versioned, shared and used in different environments (e.g. databases)
  • 25. What is going on inside a container • Can be a bit cumbersome, but possible to introspect in many ways. • top (processes are exposed to host) • ssh (if ssh server enabled- re multiple processes) • docker exec -t -i <container id> bash -l • docker inspect <container id>
  • 26. Enough already, can't we just fire them up?
  • 27. Docker Compose • previously known as fig • Tool for setting up several containers linked together. • Handled by a single configuration • We use it to set up infrastructure and perform integration tests
  • 30. Configuration • use production optimised defaults • use a sane convention and override when needed • make configuration expressible via system variables when possible (meaning no lists, maps etc)
  • 32. Discovery • Keep service discovery out of the service • Keep service discovery out of the image containing the service • Use Docker events and have a dedicated discovery agent running and reporting
  • 34. Routing • We have now many services/containers running, each on a random port on different machines. • How do we route traffic to and from? • Docker Compose can help (also in prod systems) • We decided to write HAProxy configs on the fly based on Docker events (via a service discovery system - Consul and Registrator) • Consul-template reacts to events in consul, and rewrites configuration files
  • 35. HAProxy service routing • Typically two HAProxy servers with identical configuration • One front-end on port 80 that selects backend based on DNS • One backend for each service • Many load balanced servers (potentially) for each backend • Service outage will rewrite configuration file and restart HAProxy • Service additions will rewrite configuration file and restart HAProxy
  • 36. Other interesting Docker tools and notes • Docker Machine • Docker Swarm • ECS from Amazon • https://github.com/gliderlabs/logspout • https://github.com/GoogleCloudPlatform/kubernetes • Many others, but difficult to separate hype from promising projects.
  • 37. ?