Skip to content
BoKSA

Docker for Edge and IoT

Docker for Edge and IoT

Introduction

Your team has a Raspberry Pi running Mosquitto, Node-RED, and a small database. Installing everything by hand on each board is fragile, versions drift, dependencies conflict, and "it worked on my laptop" returns.

Docker packages an application and its dependencies into an image you run as a container, isolated, repeatable, easy to redeploy. For embedded engineers, Docker is less about the MCU firmware and more about the gateway and cloud edge: the Linux box next to your robots.


Core concepts

Term Meaning
Image Read-only template (e.g. eclipse-mosquitto)
Container Running instance of an image
Dockerfile Recipe to build your own image
Volume Persistent data outside container filesystem
Port mapping -p 1883:1883 exposes broker to LAN
Docker Compose YAML file defining multi-container stacks

In plain terms

An image is a frozen lunch box with exact food inside. A container is when you heat and eat one serving, same recipe every time, no surprise missing salt.


Why embedded/IoT teams use it

Benefit Example
Reproducible lab Same Mosquitto + Node-RED stack on every Pi
Isolation Database crash does not kill broker
Updates Pull new image tag; roll back if broken
CI/CD Build gateway services in pipeline

MCUs still flash firmware normally, Docker runs on Linux gateways (Pi, industrial PC, cloud VM).


Minimal example, MQTT broker

1
docker run -d --name mosquitto -p 1883:1883 eclipse-mosquitto:2

Devices on the LAN connect to pi-ip:1883. Config and persistence mount via volumes in real projects.

Docker Compose (sketch):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
services:
  mosquitto:
    image: eclipse-mosquitto:2
    ports:
      - "1883:1883"
  nodered:
    image: nodered/node-red:latest
    ports:
      - "1880:1880"
    depends_on:
      - mosquitto

Install paths (pick your machine)

Platform Notes
Raspberry Pi Docker Engine for ARM
Windows / macOS Docker Desktop for development
Linux server Native engine, common in cloud

Use official install docs for your OS, versions change; concepts stay the same.


Videos, other ways to learn

Why use Docker

Why Use Docker - Docker Tutorial For Beginners

What is Docker

What is Docker

Docker client basics

Using the Docker Client

What is a container

But Really, What's a Container?

Quick overview

Learn Docker in 12 Minutes

Docker Compose

Docker Compose in 12 Minutes


Relevant topics


Starting points

  1. Install Docker on your dev machine; run docker run hello-world.
  2. Start Mosquitto container; connect with mosquitto_sub from host.
  3. Write a two-service docker-compose.yml for broker + Node-RED.
  4. Export compose file to Git, teammates reproduce in one command.

Focus points

  • Containers are not VMs, they share the host kernel; understand isolation limits.
  • Persist data with volumes, container delete should not wipe MQTT config.
  • ARM vs x86 images, Pi needs ARM-compatible tags.
  • Secrets, use env files or Docker secrets, not hardcoded passwords in Git.

Key points

  • Docker makes gateway stacks repeatable on Pis and servers.
  • Image + container + compose are the vocabulary you need first.
  • Pair with Node-RED and MQTT for full IoT lab architecture.