Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Docker on IOT
Dockercon19 SFO Recap &
Announcements, Bangalore
15 Jun 2019
$Whoami
Sangam Biradar
Github-sangam14
Twitter-BiradarSangam
$curl engineitops.icu
- My Personal Blog Website
- Over 100+ blog post on docker | Golang and kubernetes and
cloud
- Unique 10000+ hits
- Research Papers Presented/Published in the Conference
Proceedings(IEEE)
1.“Build Minimal Docker Container Using Golang’’- presented
and published in the proceedings of the International
Conference ICICCS2018 at Vaigai College Of Engineering,
Madurai 14 June 18
Agenda
- Why the IOT Needs Docker?
- How to setup Docker Swarm Cluster on
Raspberry Pi
- Docker Container for Raspberry Pi to Blink
an LED
- Questions?
Why the IoT Needs Docker?
- Minimal hardware resources.
- Geographic distribution.
- Limited or sporadic network access
- Widely varying device environments.
How to setup Docker Swarm
Cluster on Raspberry Pi?
Docker Container for
Raspberry Pi to Blink an LED
- Install Docker on Raspberry pi
sudo apt-get update && sudo apt-get upgrade
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker your-username
Prepare the Circuit:
Clone repo
Git clone https://github.com/sangam14/Docker-IOT-rpi.git
$ cd Docker-IOT-rpi
Docker-IOT-rpi $ ls
Dockerfile ledblinker.py readme.md
ledblinker.py
Dockerfile
# Python Base Image from https://hub.docker.com/r/arm32v7/python/
FROM arm32v7/python:2.7.13-jessie
# Copy the Python Script to blink LED
COPY led_blinker.py ./
# Intall the rpi.gpio python module
RUN pip install --no-cache-dir rpi.gpio
# Trigger Python script
CMD ["python", "./led_blinker.py"]
docker-build
pi@raspberrypi:~/docker-ledblink $ docker build -t "docker_blinker:v1” .
Sending build context to Docker daemon 3.072kB
Step 1/4 : FROM arm32v7/python:2.7.13-jessie ---> fd232f7d5f5f
Step 2/4 : COPY led_blinker.py ./ ---> Using cache ---> 2c20ac080696
Step 3/4 : RUN pip install --no-cache-dir rpi.gpio ---> Using cache --->
1d7557012625
Step 4/4 : CMD ["python", "./led_blinker.py"] ---> Using cache ---> 856014f90903
Successfully built 856014f90903
Successfully tagged docker_blinker:v1
Run Container
pi@raspberrypi:~/docker-ledblink $ docker container run --
device /dev/gpiomem -d docker_blinker:v1
OR
docker container run --privileged -d docker_blinker:v1
Reference :
https://github.com/raspberrypi/linux/pull/1112
Demo
You should see it
successfully Running
Cheers !
Stop container :-
docker stop $(docker ps -a -q)
https://github.com/collabnix/dockerlabs/blob/master/
beginners/install/raspberrypi3/Docker-
IOT_Using_Arduino_Uno_and_Johnny-Five.md
Questions?
Thanks

More Related Content

Docker on IOT - Dockercon19 SFO Recap & Announcements, Bangalore

  • 1. Docker on IOT Dockercon19 SFO Recap & Announcements, Bangalore 15 Jun 2019
  • 2. $Whoami Sangam Biradar Github-sangam14 Twitter-BiradarSangam $curl engineitops.icu - My Personal Blog Website - Over 100+ blog post on docker | Golang and kubernetes and cloud - Unique 10000+ hits - Research Papers Presented/Published in the Conference Proceedings(IEEE) 1.“Build Minimal Docker Container Using Golang’’- presented and published in the proceedings of the International Conference ICICCS2018 at Vaigai College Of Engineering, Madurai 14 June 18
  • 3. Agenda - Why the IOT Needs Docker? - How to setup Docker Swarm Cluster on Raspberry Pi - Docker Container for Raspberry Pi to Blink an LED - Questions?
  • 4. Why the IoT Needs Docker? - Minimal hardware resources. - Geographic distribution. - Limited or sporadic network access - Widely varying device environments.
  • 5. How to setup Docker Swarm Cluster on Raspberry Pi?
  • 6. Docker Container for Raspberry Pi to Blink an LED - Install Docker on Raspberry pi sudo apt-get update && sudo apt-get upgrade curl -sSL https://get.docker.com | sh sudo usermod -aG docker your-username
  • 8. Clone repo Git clone https://github.com/sangam14/Docker-IOT-rpi.git $ cd Docker-IOT-rpi Docker-IOT-rpi $ ls Dockerfile ledblinker.py readme.md
  • 10. Dockerfile # Python Base Image from https://hub.docker.com/r/arm32v7/python/ FROM arm32v7/python:2.7.13-jessie # Copy the Python Script to blink LED COPY led_blinker.py ./ # Intall the rpi.gpio python module RUN pip install --no-cache-dir rpi.gpio # Trigger Python script CMD ["python", "./led_blinker.py"]
  • 11. docker-build pi@raspberrypi:~/docker-ledblink $ docker build -t "docker_blinker:v1” . Sending build context to Docker daemon 3.072kB Step 1/4 : FROM arm32v7/python:2.7.13-jessie ---> fd232f7d5f5f Step 2/4 : COPY led_blinker.py ./ ---> Using cache ---> 2c20ac080696 Step 3/4 : RUN pip install --no-cache-dir rpi.gpio ---> Using cache ---> 1d7557012625 Step 4/4 : CMD ["python", "./led_blinker.py"] ---> Using cache ---> 856014f90903 Successfully built 856014f90903 Successfully tagged docker_blinker:v1
  • 12. Run Container pi@raspberrypi:~/docker-ledblink $ docker container run -- device /dev/gpiomem -d docker_blinker:v1 OR docker container run --privileged -d docker_blinker:v1 Reference : https://github.com/raspberrypi/linux/pull/1112
  • 13. Demo
  • 14. You should see it successfully Running Cheers ! Stop container :- docker stop $(docker ps -a -q) https://github.com/collabnix/dockerlabs/blob/master/ beginners/install/raspberrypi3/Docker- IOT_Using_Arduino_Uno_and_Johnny-Five.md