1 / 70

Run Java applications with Docker on the Raspberry Pi and other platforms

Run Java applications with Docker on the Raspberry Pi and other platforms. Johan Janssen, Info Support. Content. Internet of Things Docker and Java on a Raspberry Pi Jenkins Questions. Internet of Things. Potential market. Huge and still growing Not stable yet, lots of innovation

vance
Download Presentation

Run Java applications with Docker on the Raspberry Pi and other platforms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Run Java applications with Docker on the Raspberry Pi and other platforms Johan Janssen, Info Support

  2. Content • Internet of Things • Docker and Java on a Raspberry Pi • Jenkins • Questions

  3. Internet of Things

  4. Potential market • Huge and still growing • Not stable yet, lots of innovation • Cool new technologies • Suitable for Java!

  5. Weather station

  6. Drone

  7. Wave Glider

  8. Wearables

  9. Robots

  10. Raspberry Pi

  11. Raspberry Pi

  12. Developments outside the IoT • Continuous Delivery • Virtual machines • Provisioning (Chef, Puppet, Vagrant …) • Version control / infrastructure as code • Isolation • Updating and synchronizing environments

  13. IoT limitations

  14. What to deliver?

  15. Docker

  16. Transportation issue

  17. Transportation solution

  18. Software issue

  19. Software solution

  20. Docker compatibility

  21. Why Docker • To enable continuous delivery • Quickly provision environments • Easy to roll forward • Security • For instance to run ‘untrusted’ applications like a Dropbox client • Alternative for virtual machines • On top of virtual machines

  22. Docker vs Virtual Machines • Disk space efficiency • Memory efficiency • Speed • Compatibility (run anywhere) • Isolation • Versioning • Internet of Things (Raspberry Pi etc.)

  23. Docker vs provisioning tools • Simple general commands • No Domain Specific Language (DSL) • Configuration with operating system commands

  24. Docker activity • Since March 2013 • More than 460 570 contributors • Downloaded 2.75 13 million times • More than 14000 30000 Dockerized apps • More than 90 user groups, DockerCon(Europe) • Support from Google, VMWare, RackSpace, Red Hat, IBM, Microsoft etcetera

  25. Docker on CIO TODAY

  26. Docker ecosystem

  27. My first Docker container • Docker on Ubuntu 14.04 apt-get install docker.io docker.io run -i -t ubuntu:saucy/bin/bash

  28. My first Pi Dockercontainer • Docker on the Raspberry Pi dockerrun -i–t resin/rpi-raspbian/bin/bash

  29. Docker technology

  30. Raspberry installation • Download Arch Linux http://downloads.raspberrypi.org/arch_latest • unzip ArchLinuxARM-2014.06-rpi.img.zip • Find SD card: sudofdisk -l • sudoddbs=1M if=ArchLinuxARM-2014.06-rpi.img of=/dev/sdX • Change partitions (optional) • Put the SD card in the Raspberry Pi and boot username and password are both ‘root’

  31. Raspberry installation • Update repositories pacman –Syy • Optional update al packages: pacman-Syu • Install Docker pacman-S docker

  32. Raspberry installation • Start Dockerservice systemctlstart docker • Auto start Docker service on boot systemctlenable docker • Reboot

  33. Configure static IP address • cp/etc/netctl/examples/ethernet-static /etc/netctl/static • Edit /etc/netctl/static Description='A basic static ethernet connection' Interface=eth0 Connection=ethernet AutoWired=yes IP=static Address=('192.168.1.3/24') Gateway='192.168.1.1' DNS=('192.168.1.1')

  34. Static IP address • Enable static ip netctlenable static • Disable static ip mv /etc/netctl/static /etc/netctl/examples/

  35. Tomcat Dockerfile FROM resin/rpi-raspbian RUN apt-get update RUN apt-get install -y openjdk-7-jre-headless wget RUN wget -O /tmp/tomcat8.tar.gz http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.9/bin/apache-tomcat-8.0.9.tar.gz RUN (cd /opt && tar zxf /tmp/tomcat8.tar.gz) RUN (mv /opt/apache-tomcat* /opt/tomcat) ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk-armhf RUN rm -rf /opt/tomcat/webapps/docs /opt/tomcat/webapps/examples /opt/tomcat/webapps/host-manager /opt/tomcat/webapps/manager EXPOSE 8080 CMD ["/opt/tomcat/bin/catalina.sh", "run"]

  36. Tomcat Dockerfile explained FROM resin/rpi-raspbian RUN apt-get install -y openjdk-7-jre-headless wget ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk-armhf EXPOSE 8080 CMD ["/opt/tomcat/bin/catalina.sh", "run"]

  37. TomcatExtraDockerfile FROM tomcat ADD DockerPiExample.war /opt/tomcat/webapps/

  38. Directory structure • Main directory • BuildAndRunScript.sh • Tomcat • Dockerfile • TomcatExtra • Dockerfile • DockerPiExample.war

  39. Build • Create the Dockerfiles • Build the containers cd Tomcat (optional) dockerbuild -t tomcat . (optional) cd .. (optional) cd TomcatExtra docker build -t tomcatextra.

  40. Run • Start the container dockerrun -p 8080:8080 -d tomcatextra

  41. Hyper Text Coffee Pot Control Protocol • April Fools prank • It might become real

  42. Hyper Text Coffee Pot Control Protocol

  43. Controlling containers • Start / stop / restart docker [start/stop/restart] containerid • Follow SystemOut and SystemErr docker logs -f containerid

  44. Controlling containers • Show (running) containers dockerps –a • Show processes running in container dockerdiff containerid • Show changes in the container dockertop containerid

  45. Controlling containers • Stop all containers docker.io stop $(docker.io ps -a -q) • Remove all containers docker.io rm $(docker.io ps -a -q) • Remove all images docker.io rmi $(docker.io images -q)

  46. Demo

  47. Docker overview

  48. One ring to rule them all

  49. Docker registry • Creating the Docker registry docker run -p 5000:5000 registry

More Related