Demystifying Docker
JUG Saxony Day 2015
Bernd Fischer
Demystifying Docker JUG Saxony Day 2015 Bernd Fischer Whos that - - PowerPoint PPT Presentation
Demystifying Docker JUG Saxony Day 2015 Bernd Fischer Whos that guy? Passionate Java Developer (especially Spring) Agile and Devops infected Docker enthusiast berndfischer63@gmail.com @berndfischer63 JUG Saxony, Docker Meetup Dresden
JUG Saxony Day 2015
Bernd Fischer
Passionate Java Developer (especially Spring) Agile and Devops infected Docker enthusiast berndfischer63@gmail.com @berndfischer63 JUG Saxony, Docker Meetup Dresden CTO MindApproach GmbH, Dresden bfischer@mindapproach.de
Werner Vogels, CTO Amazon, 2006 [Gra01]
Continuous Delivery, 2010 [HuFa01]
What is Docker? Dockerize a Java Web Application in five steps Leassons learned
What is Docker
Virtual Machine Hypervisor / Host OS Physical Server Physical Server Host OS App A App B Libs Libs Guest OS Virtual Hardware / BIOS Docker Engine Container (Process) App A Libs Container App A Libs
Docker Libcontainer Namespaces Control Groups Storage Backends Layered/CoW Filesystems Linux Kernel Software Defined Networking
read only writable empty after creation many containers can be created based on one image
Maven Central for Docker ...
Docker Host (Linux) Docker Client Docker Daemon Container Images Container Container Images Images Socket RESTFul API Docker Client Windows Docker Client Mac OS V Docker Client
Virtual Machine (Linux) Images Container Mac OS X Windows /Users /Users Docker Client Docker Daemon
Dockerize a Java Web Application
Linux (Ubuntu 14.04.3-LTS)
java -jar ... url username password
JVM Demo-Application
Spring Boot Web embedded Tomcat
Database
Docker Machine
docker-machine \ create \
jsd2015
Docker Compose
# s01-docker-compose.yaml mysql: image: mysql:5.6.26 expose:
ports:
environment:
# s02-docker-compose.yaml (snippet) app: image: java:8 ports:
environment:
working_dir: /opt/demo-helloworld-web links:
entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/opt/demo-helloworld-web/demo-helloworld-web-1.0-Local.jar" ] volumes:
# maven -PunzipFatJar # unzip target/demo-helloworld-web-1.0-Local.jar \
# s03-docker-compose.yaml (snippet) app: # ... volumes:
# Dockerfile FROM java:8 MAINTAINER Bernd Fischer "bfischer@mindapproach.de" ENV MODIFIED_AT 2015-09-26_1845 COPY demo-helloworld-web.jar /opt/demo-helloworld-web/ # mvn -PbuildDockerWorkDir # copy Dockerfile and “Fat-Jar” in separate dir # should be called from project root dir docker build -t mapp/demo-helloworld-web04:latest \
$(pwd)/target/workdir-docker
# s04-docker-compose.yaml (snippet) app: image: mapp/demo-helloworld-web04:latest ports:
environment:
working_dir: /opt/demo-helloworld-web/ links:
entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar","/opt/demo-helloworld-web/demo-helloworld-web.jar" ] _________
# Maven (snippet) <plugin> <groupId>org.jolokia</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.13.4</version> <configuration> <dockerHost>${env.DOCKER_HOST}</dockerHost> <certPath>${env.DOCKER_CERT_PATH}</certPath> <images> <image> <name>mapp/demo-helloworld-web05</name> ... </image> </images> </configuration> ... </plugin>
# s05-docker-compose.yaml (snippet) app: image: mapp/demo-helloworld-web05:latest ports:
environment:
working_dir: /opt/demo-helloworld-web/ links:
entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar","/opt/demo-helloworld-web/demo-helloworld-web.jar" ]
Lessons learned
Bereitstellung von Tools und Komponenten Verpacken und Deployen von Anwendungen Einfache Definition und Ausführung von (komplexen) Anwendungslandschaften (“Compositions”) Unit-/Modultests ...
One more thing ...
Private Docker Registries
JFrog Artifactory (Docker support commercial only) Sonatype Nexus V3.0.0
CI-/CD-Pipelines
Jenkins-Docker-Image Jenkins Workflow Engine, Docker Plugins, …
Questions … ?
Thanks for attention ...
platform, 2006, siehe: https://queue.acm.org/detail.cfm?id=1142065
Build, Test and Deployment Automation, 2010, Addison-Wesley