DockerCon19 recap — Docker on IOT at Visa Office Bangalore — 15 Jun 19

on 15th Jun 19 It was a wonderful opportunity to speak at Docker Meetup Bangalore sharing my overall experience and hands on .

docker Meetup at visa office
[Best_Wordpress_Gallery id=”1″ gal_title=”All images”]

Why the IoT Needs Docker

  • Minimal hardware resources:-

Many IoT devices lack powerful computing and memory resources. Their ability to process software updates is therefore limited. Containers can help on this front because installing a new container image does not require much computing power. An IoT device needs simply to download an image, put it wherever it’s going to live and remove the old image. Configuration processing is minimal.

  • Geographic distribution.

In some use cases, IoT devices are spread across a large geographic area. Delivering software to them from a single central repository may not work well. With Docker, it’s easy to spin up image registries in multiple locations to serve the entire network well.

  • Limited or sporadic network access.

Despite the implications of the term “internet of things,” not all devices on the internet of things are well-connected to the internet. They may have limited network bandwidth, or be online only occasionally.

Docker can help to deliver software updates under these circumstances because when container images are updated, Docker downloads only the parts of the image that have changed. ( is taking this efficiency a step further through delta updates, which enable an even more selective download process when updating a container image.)

  • Widely varying device environments.

The software that runs on an IoT device could be almost anything. The diversity of software configurations on IoT devices would normally make application installation difficult, because applications would have to be configured for each type of environment if installed via traditional methods. With containers, however, the operating system version and other software variables are much less important. As long as the device runs some kind of Linux distribution and has a container runtime, you can install a containerized application on it without special configuration.



  • atleast 2 raspberry pi device
  • keyboard , mouse ,monitor, wifi adapter for each Raspberry pi ( if its not inbuild in pi)
  • led , female or male jumper cable , breadbord , resistor
  • Docker installed on rasberry pi ( using Debian )

Install Docker on Raspberry pi

sudo apt-get update && sudo apt-get upgrade 
curl -sSL | sh
sudo usermod -aG docker your-username 

Prepare the circuit:

Create docker swarm :

docker swarm init -- advertise-addr --listen-addr

copy and past the tocken to manger

Node2 is hostname(rasberrypi) which act as leader

Rasberrypi is username of another rasberry pi which is master

check with following command

docker node ls 

two nodes are in active state :(make sure they are connected in one network)

make Directory

mkdir Docker-ledblink

jump into Directory

cd Docker-ledblink
# nano / vi

import RPi.GPIO as GPIO
import time
# Configure the PIN # 8
GPIO.setup(8, GPIO.OUT)
# Blink Interval 
blink_interval = .5 #Time interval in Seconds
# Blinker Loop
while True:
GPIO.output(8, True)
GPIO.output(8, False)
# Release Resources


nano / vi Dockerfile

# Python Base Image from
FROM arm32v7/python:2.7.13-jessie
# Copy the Python Script to blink LED
# Intall the rpi.gpio python module
RUN pip install — no-cache-dir rpi.gpio
# Trigger Python script
CMD [“python”, “./”]
# build dockerfile 

Build dockefile

pi@raspberrypi:~/docker-ledblink $ ls
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 ./
— -> Using cache
— -> 2c20ac080696
Step 3/4 : RUN pip install — no-cache-dir rpi.gpio
— -> Using cache
— -> 1d7557012625
Step 4/4 : CMD [“python”, “./”]
— -> 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


docker container run — privileged -d docker_blinker:v1

stop container

docker stop $(docker ps -a -q)

connect with me via Twitter or Linkedln


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *