demystifying docker
play

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


  1. Demystifying Docker JUG Saxony Day 2015 Bernd Fischer

  2. Who’s that guy? 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

  3. Who’s that guy? You build it you run it Werner Vogels, CTO Amazon, 2006 [Gra01]

  4. Who’s that guy? Automate almost everything Continuous Delivery, 2010 [HuFa01]

  5. Agenda Demystifying Docker ... What is Docker? Dockerize a Java Web Application in five steps Leassons learned

  6. What is Docker

  7. What is Docker? Container vs VM Container Container Virtual Machine (Process) App A App B App A App A Libs Libs Libs Libs Guest OS Docker Engine Virtual Hardware / BIOS Hypervisor / Host OS Host OS Physical Server Physical Server

  8. What is Docker? Used Technologies Docker Libcontainer Software Defined Storage Backends Control Groups Namespaces Networking Layered/CoW Filesystems Linux Kernel

  9. What is Docker? Images & Container writable empty after creation read only many containers can be created based on one image

  10. What is Docker? Dockerhub Maven Central for Docker ...

  11. What is Docker? System Architecture Windows Mac OS V Docker Client Docker Client Docker Client RESTFul API Socket Docker Client Docker Daemon Container Images Container Images Container Images Docker Host (Linux)

  12. What is Docker? Docker Project Family ● Docker-Engine (CLI + Daemon) ● Docker-Machine ● Docker-Compose ● (Docker-Swarm) ● (Docker-Distribution) ● (Docker-Toolbox) ● (Docker Notary based on TUF) ● (Docker-Bench-Security)

  13. What is Docker? Development Environment Mac OS X Windows Virtual Machine (Linux) Docker Docker Client Daemon Images /Users /Users Container

  14. Dockerize a Java Web Application

  15. Dockerize a Java Web App Starting Point Demo-Application Spring Boot Web JVM Database embedded Tomcat url username java -jar ... password Linux (Ubuntu 14.04.3-LTS)

  16. Dockerize a Java Web App Starting Point DEMO

  17. Dockerize a Java Web App MySql - local Installation

  18. Dockerize a Java Web App MySql - local Installation

  19. Dockerize a Java Web App MySql - local Installation

  20. Dockerize a Java Web App MySql - Container

  21. Dockerize a Java Web App MySql - Container docker-machine \ create \ --driver=virtualbox \ jsd2015 Docker Machine

  22. Dockerize a Java Web App MySql - Container DEMO

  23. Dockerize a Java Web App MySql - Container # s01-docker-compose.yaml mysql: image: mysql:5.6.26 expose: - "3306" ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=9876 - MYSQL_USER=test - MYSQL_PASSWORD=1234 - MYSQL_DATABASE=test Docker Compose

  24. Dockerize a Java Web App MySql - Container DEMO

  25. Dockerize a Java Web App Java - Container # s02-docker-compose.yaml (snippet) app: image: java:8 ports: - "8080:8080" environment: - SPRING_PROFILES_ACTIVE=initdb working_dir: /opt/demo-helloworld-web links: - mysql:mysql entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/opt/demo-helloworld-web/demo-helloworld-web-1.0-Local.jar" ] volumes: - ../../../target:/opt/demo-helloworld-web:ro

  26. Dockerize a Java Web App Java - Container DEMO

  27. Dockerize a Java Web App Unpacked Fat-Jar # maven -PunzipFatJar # unzip target/demo-helloworld-web-1.0-Local.jar \ -d target/app # s03-docker-compose.yaml (snippet) app: # ... volumes: - ../../../target/app/META-INF:/opt/.../META-INF:ro - ../../../target/classes/de:/opt/.../de:ro - ../../../target/app/lib:/opt/.../lib:ro - ../../../target/app/org:/opt/.../org:ro - ../../../target/classes/static:/opt/.../static:ro - ../../../target/classes/templates:/opt/.../templates:ro - ../../../target/classes/application.yml:/opt/.../application.yml:ro - ../../../target/classes/logback.xml:/opt/.../logback.xml:ro

  28. Dockerize a Java Web App Unpacked Fat-Jar DEMO

  29. Dockerize a Java Web App Docker Image by Foot # 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 \ -f $(pwd)/target/workdir-docker/Dockerfile \ $(pwd)/target/workdir-docker

  30. Dockerize a Java Web App Docker Image by Foot # s04-docker-compose.yaml (snippet) app: image: mapp/demo-helloworld-web04:latest ports: - "8080:8080" environment: - SPRING_PROFILES_ACTIVE=initdb working_dir: /opt/demo-helloworld-web/ links: - mysql:mysql entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar","/opt/demo-helloworld-web/demo-helloworld-web.jar" ] _________

  31. Dockerize a Java Web App Docker Image by Foot DEMO

  32. Dockerize a Java Web App Docker Image by Maven # 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>

  33. Dockerize a Java Web App Docker Image by Maven # s05-docker-compose.yaml (snippet) app: image: mapp/demo-helloworld-web05:latest ports: - "8080:8080" environment: - SPRING_PROFILES_ACTIVE=initdb working_dir: /opt/demo-helloworld-web/ links: - mysql:mysql entrypoint: [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar","/opt/demo-helloworld-web/demo-helloworld-web.jar" ]

  34. Dockerize a Java Web App Docker Image by Maven DEMO

  35. Lessons learned

  36. Lessons Learned Bereitstellung von Tools und Komponenten Verpacken und Deployen von Anwendungen Einfache Definition und Ausführung von (komplexen) Anwendungslandschaften (“Compositions”) Unit-/Modultests ...

  37. One more thing ...

  38. 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, …

  39. Questions … ?

  40. Thanks for attention ...

  41. Links ... ● [ Gra01] J. Gray, A Conversation with Werner Vogels: Learning form the Amazon technology platform, 2006, siehe: https://queue.acm.org/detail.cfm?id=1142065 ● [HuFa01] Jez Humble, David Farley, Continuous Delivery: Reliable Software Releases Through Build, Test and Deployment Automation, 2010, Addison-Wesley ● ● [Do01] Docker Homepage https://www.docker.com/ ● [Do02] Docker Hub https://hub.docker.com/ ● [Do03] Docker Engine https://github.com/docker/docker ● [Do04] Docker Machine https://github.com/docker/machine ● [Do05] Docker Compose https://github.com/docker/compose ● [Do06] Docker Toolbox https://github.com/docker/toolbox ● ● [Http01] Httpie Homepage http://httpie.org/ ● ● [RHu01] Docker-Maven-Plugin https://github.com/rhuss/docker-maven-plugin ● [RHus02] Docker Maven Plugin Shootout: https://github.com/rhuss/shootout-docker-maven ● ● [Ma01] https://bitbucket.org/mindapproach/demo-helloworld-web

Recommend


More recommend