gebruik dezelfde docker container voor java applicaties tijdens ontwikkelen en in de cloud

Post on 31-Dec-2015

24 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen en in de cloud. Johan Janssen, Info Support. Content. Continuous delivery Docker Jenkins Questions. Continuous Delivery. Automate everything Software quality Continuous improvement Regular deployments - PowerPoint PPT Presentation

TRANSCRIPT

Gebruik dezelfde Docker container voor Java applicaties tijdens

ontwikkelen en in de cloud

Johan Janssen, Info Support

Content

Continuous delivery

Docker

Jenkins

Questions

Continuous Delivery

Automate everything

Software quality

Continuous improvement

Regular deployments

Anyone can deploy

Deployment pipeline

Version control

Compile

Quality checks

Testing

Deployments

DevOps End users

Etcetera

Setup environment

Deployment pipeline

Focus of this presentation

Automate environment provisioning

Automate application deployment

What to deliver?

Docker

Transportation issue

Transportation solution

Software issue

Software solution

Docker compatibility

Demo

Why Docker

To enable continuous delivery Quickly provision environments Run the same software local and in

the cloud Easy to move software

Better performance Higher availability Cheaper

Docker vs Virtual Machines

Disk space efficiency Memory efficiency Speed Compatibility (run anywhere) Isolation Versioning Internet of Things (Raspberry Pi

etc.)

Docker vs provisioning tools

Simple general commands No Domain Specific Language

(DSL) Configuration with operating

system commands

Docker activity

Since March 2013 8741 commits in 15 months More than 460 570 contributors Downloaded 2.75 13 million times More than 14000 30000 Dockerized apps >6500 Docker related projects on GitHub More than 90 user groups DockerCon (Europe) Support from Google, VMWare,

RackSpace, Red Hat, IBM, Microsoft etcetera

Docker on CIO TODAY

Windows will get Docker support

My first Docker container

Docker on Ubuntu 14.04

apt-get install docker.io

docker.io run -i -t ubuntu:saucy /bin/bash

Docker technology

Dockerfiles directory structure

Main directory BuildAndRunScript.sh GeneralBase

Dockerfile Sonar

Dockerfile

Dockerfile GeneralBase

FROM ubuntu:saucy

RUN apt-get -y install software-properties-common

RUN add-apt-repository ppa:webupd8team/javaRUN apt-get update && apt-get -y upgradeRUN echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 boolean true" | debconf-set-selectionsRUN apt-get -y install oracle-java7-installerENV JAVA_HOME /usr/lib/jvm/java-7-oracle

Dockerfile SonarFROM GeneralBase

RUN apt-get install -y wget unzipRUN wget http://dist.sonar.codehaus.org/sonarqube-4.2.zipRUN unzip sonarqube-4.2.zip -d /optRUN rm sonarqube-4.2.zip

EXPOSE 9000 EXPOSE 9092CMD ["/opt/sonarqube-4.2/bin/linux-x86-64/sonar.sh", "console", "/bin/bash"]

Build

Create the Dockerfiles Build the containers:

<optional>cd GeneralBasedocker.io build -t GeneralBase . cd .. </optional>cd Sonardocker.io build -t Sonar .

Run

Start the containerdocker.io run -p 9000:9000

–p 9092:9092 -d Sonar

List all in(active) containers

# docker.io ps –aCONTAINER ID: ecbecf77461b CREATED: 32 minutes ago STATUS: Up 32 minutes PORTS: 0.0.0.0:9000->9000/tcp, 0.0.0.0:9092->9092/tcp

Controlling containers

Start / stop / restartdocker [start/stop/restart] containerid

Follow SystemOut and SystemErrdocker logs -f containerid

Controlling containers

Show (running) containersdocker ps –a

Show processes running in container

docker top containerid

Show changes in the containerdocker diff containerid

Controlling containers

Stop all containersdocker.io stop $(docker.io ps -a -q)

Remove all containersdocker.io rm $(docker.io ps -a -q)

Remove all imagesdocker.io rmi $(docker.io images -q)

We need lots of Docker containers

GeneralBase

AppServerBase

Environment D

Environment T

Environment A

Environment P

Jenkins

JenkinsDataContainer

Sonar Gitblit Nexus

Data volumes

DockerfileENV JENKINS_HOME /var/JenkinsData

Docker commandsdocker.io run -v /var/JenkinsData –name JenkinsDataContainer ubuntu:saucy true

docker.io run -p 8080:8080 --volumes-from JenkinsDataContainer -d Jenkins

Diskspace# docker.io images --tree└─ 179.9 MB Tags: ubuntu:saucy └─253.6 MB └─741.8 MB Tags: GeneralBase:latest └─763.6 MB Tags: AppServerBase:latest

… ├─763.6 MB Tags:

EnvironmentP:latest └─865.6 MB Tags: Nexus:latest

└─808.3 MB Tags: Gitblit:latest └─901.5 MB Tags: Sonar:latest └─805.4 MB Tags: Jenkins:latest

Execution time

real 4m11.729suser 0m3.329s sys 0m10.054s

Docker overview

One ring to rule them all

Docker registry

Creating the Docker registrydocker run -p 5000:5000 registry

Docker client 1 (push)

Modify container Commit

docker.io commit 064f192.168.56.31:5000/test-version-0.2

New containerid -> ff7e

Pushdocker.io push

192.168.56.31:5000/test-version-0.2

Docker client 2 (pull)

Pulldocker.io pull 192.168.56.31:5000/

test-version-0.2

Rundocker.io run -i -t ff7e /bin/bash

View the changed container

Updating containers

Pull update only

docker images -tree└─153b 194.2 MB test-version-0.1:latest

docker pull 192.168.56.31:5000/test-version-0.2 ff7e: Download complete153b: Download complete

docker images -tree└─153b 194.2 MB test-version-0.1:latest └─ff7e 194.2 MB test-version-0.2:latest

Docker vs Virtual Machines

Jenkins

Demo

Why Jenkins

Simple to use Really popular

Used in many organizations Regular updates Big community creating plugins

etc.

Most developers already use it

Example build pipeline

TAP

D

1

2

34

6

7

8

9

5

Jenkins

Backend pipeline

Frontend pipeline

Combined pipeline

Automatic versus manual deployment

Continuous delivery

Continuous deployment

Automatic versus manual

Build pipeline plugin

Publish over SSH plugin

Publish over SSH plugin

Keep it simple

“Life is really simple, but we insist on making it complicated.”

- Confucius

Build pipeline demo

Tips Use a (private) Docker registry Use images from the registry instead of

export Keep environmental settings separate Use Jenkins to manage everything Do not add extra functionality like

OpenSSH Think about topics such as security,

monitoring and logging Separate concerns in separate containers Inherit containers

Isolation

Isolation

Isolation

Isolation

Summary

Questions

johan.janssen@infosupport.comhttp://blogs.infosupport.com/author/johanj/

top related