Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dockerizing IoT Services

475 views

Published on

This slides describe how to put Docker on Internet of Things (IoT) especially Raspberry Pi 2. Describing 2 options Hypriot and Ubuntu 15.10 MATE and challenges for using Docker on Raspberry Pi 2.

Published in: Devices & Hardware
  • Be the first to comment

  • Be the first to like this

Dockerizing IoT Services

  1. 1. Dockerizing IoT Services Mohd Syukor Abdul Open Source Community
  2. 2. In this hour … • Internet of Things • What is IoT? • IoT Services? • Docker • What is Docker? • Docker CLI • Dockerfile • Raspberry Pi 2 • Board • Operating System • Where to buy? • Docker on Raspberry Pi 2 • Current OS • Dockerizing … • Demo
  3. 3. Internet of Things
  4. 4. What is Internet of Things (IoT)? • The Internet of Things (IoT) is the network of physical objects or "things" embedded with electronics, software, sensors, and network connectivity, which enables these objects to collect and exchange data. https://en.wikipedia.org/wiki/Internet_of_Things
  5. 5. Billions of Things Connected to Internet by 2020 • The estimated 26 billion units to be installed within the Internet of Things by 2020, according to Gartner, Inc., do not include PCs, tablets and smartphones. • Cisco and Intel estimate 50 billion connected devices by 2020.
  6. 6. Stacks of IoT http://blogs.technet.com/b/uktechnet/archive/2014/07/31/what-is-the-internet-of-things-and-where-does-microsoft-sit.aspx
  7. 7. #DockerCon EU 2015
  8. 8. IoT: Youtube Videos … https://www.youtube.com/watch?v=q4VbJ6Rju8g https://www.youtube.com/watch?v=i5AuzQXBsG4
  9. 9. Docker
  10. 10. What is Docker? • Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications. http://www.docker.com
  11. 11. Docker Containers • Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
  12. 12. Docker Containers = Lightweight • Containers running on a single machine all share the same operating system kernel so they start instantly and make more efficient use of RAM. • Images are constructed from layered filesystems so they can share common files, making disk usage and image downloads much more efficient.
  13. 13. Docker vs Virtual Machine Virtual Machine Docker
  14. 14. Docker CLI • docker build # Build an image from a Dockerfile • docker images # List all images on a Docker host • docker run # Run an image • docker ps # List all running and stopped instances • docker stop # Stop a running instances • docker rm # Remove an instance • docker rmi # Remove an image • docker stats # Show running containers‘ resource usage info • docker attach # Attach to a running container • docker logs # Fetch the logs of a container • docker inspect # Return low-level information on a container or image
  15. 15. Dockerfile • Dockerfiles = image representations • Simple syntax for building images • Automate and script the images creation
  16. 16. Raspberry Pi 2
  17. 17. Board … • The Raspberry Pi 2 is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse.
  18. 18. Raspberry Pi 2 (RPi2) • RPi2 – 2nd generation of Raspberry Pi. • A 900MHz quad-core ARM Cortex-A7 CPU • 1GB RAM • 4 USB ports • 40 GPIO pins • Full HDMI port • Ethernet port • Combined 3.5mm audio jack and composite video • Camera interface (CSI) • Display interface (DSI) • Micro SD card slot • VideoCore IV 3D graphics core
  19. 19. Operating Systems for RPi2 • Because it has an ARMv7 processor, it can run the full range of ARM GNU/Linux distributions, including Snappy Ubuntu Core, as well as Microsoft Windows 10. and more to come …
  20. 20. Where to buy? In Malaysia? OR just ask Uncle * The presenter is not associate/affliate with any of them!!!
  21. 21. Docker on RPi2
  22. 22. Docker on RPi2 • Is it possible???
  23. 23. Docker on RPi2 • Is it possible??? YES!!!
  24. 24. Option 1: Hypriot
  25. 25. Hypriot Hypriot had a short demo session on the second day of the DockerCon 2015 in San Francisco,CA (USA). The goal of the demo was to show that Docker is a really lightweight “virtualization” solution that can be easily run on small IoT devices.
  26. 26. Option 2: Ubuntu 15.10 Mate for RPi2 https://ubuntu-mate.org/raspberry-pi/
  27. 27. Dockerizing ………… WAIT!!! • Docker images are the basis of containers. • Docker images are available from Docker Hub Registry. • RPi2 = platform armhf. • Build your own images • Pull images from Docker Hub Registry.
  28. 28. Challenges … (1) • Most of Docker images from Docker Hub Registry are packaged for x86/x64. • You have to build the required Docker image if no image available in Docker Hub Registry. • Docker-based apps packaged for x86/x64 will not work and will result in an error such:
  29. 29. Challenges … (2) • Limited number of packages on armhf platform. • Ubuntu MATE also provide packages management for use with RPi2 (easy for Ubuntu fans). • Use apt-get install within RPi2 running Ubuntu MATE 15.10
  30. 30. Challenges … (3) • Private Registry vs Public Registry • The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. • Private Registry: tightly control where your images are being stored, fully own your images distribution pipeline, integrate image storage and distribution tightly into your in-house development workflow. • Public Registry: zero maintenance, ready-to-go, free-to-use, hosted Registry by Docker Hub and plus additional features.
  31. 31. Now … We can start Dockerizing … • Easy jumpstart: • 1) Hypriot ( http://blog.hypriot.com/getting-started-with- docker-on-your-arm-device/ ) • 2) Ubuntu 15.10 MATE for RPi2 ( https://ubuntu- mate.org/raspberry-pi )
  32. 32. Hypriot Way … Hypriot (http://blog.hypriot.com/downloads/ ) 1) Download latest RPi2 images 2) Flash/burn the image to MicroSD card (min:8GB, class 10) 3) Ready to go
  33. 33. Ubuntu Way … Ubuntu 15.10 MATE for RPi2 (https://ubuntu- mate.org/raspberry-pi/ ) 1) Download latest RPi2 images 2) Flash/burn the image to MicroSD card (min:8GB, class 10) 3) Ready to go
  34. 34. Docker CLI … again … • docker build # Build an image from a Dockerfile • docker images # List all images on a Docker host • docker run # Run an image • docker ps # List all running and stopped instances • docker stop # Stop a running instances • docker rm # Remove an instance • docker rmi # Remove an image • docker stats # Show running containers‘ resource usage info • docker attach # Attach to a running container • docker logs # Fetch the logs of a container • docker inspect # Return low-level information on a container or image
  35. 35. Dockerfile … again … Dockerfile Reference: https://docs.docker.com/engine/reference/build er/ FROM MAINTAINER ADD COPY EXPOSE ENV EXPOSE LABEL USER CMD WORKDIR VOLUME STOPSIGNAL RUN ENTRYPOINT
  36. 36. Docker + IoT = Awesome docker pull iotms/rpi2-nginx:15.10 docker pull iotms/rpi2-ubuntu:15.10 docker pull hypriot/rpi-mysql docker run –d –p 8080:80 iotms/rpi2-nginx:15.10 docker run -d -p 8080:80 hypriot/rpi-busybox-httpd docker ps docker ps -a docker images docker inspect <container_id>
  37. 37. Demo
  38. 38. Thank You

×