VnRoboVnRobo
AboutPricingBlogContact
🇻🇳VISign InStart learning
🇻🇳VI
VnRobo logoVnRobo logo

Learn Physical AI and experiment in your browser. Connect your fleet when you have real robots.

Product

  • Features
  • Pricing
  • Knowledge Base
  • Services

Company

  • About Us
  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 VnRobo. All rights reserved.

Made with♥in Vietnam
VnRoboVnRobo
AboutPricingBlogContact
🇻🇳VISign InStart learning
🇻🇳VI
  1. Home
  2. Blog
  3. Deploy IoT Applications with Docker and Docker Compose
otherdevopsdockeriot

Deploy IoT Applications with Docker and Docker Compose

Guide to deploying IoT applications with Docker and Docker Compose on edge devices — consistent packaging, management and easy maintenance.

Nguyen Anh TuanJuly 15, 20253 min readUpdated: Nov 14, 2026

Why Docker for IoT?

In traditional IoT projects, installing software on hundreds of edge devices is nightmare — each device has different OS version, libraries, and configuration. Docker solves this by packaging entire application with dependencies in container, ensuring runs identically everywhere.

IoT devices and edge devices connected in industrial network
IoT devices and edge devices connected in industrial network

IoT Architecture with Docker

Typical IoT system has multiple services on edge device:

code
┌─────────────────────────────────┐
│         Edge Device (ARM64)      │
│  ┌───────────┐ ┌──────────────┐ │
│  │ MQTT      │ │ Data         │ │
│  │ Broker    │ │ Collector    │ │
│  └───────────┘ └──────────────┘ │
│  ┌───────────┐ ┌──────────────┐ │
│  │ InfluxDB  │ │ Grafana      │ │
│  │ (TimeSeries) │ (Dashboard) │ │
│  └───────────┘ └──────────────┘ │
└─────────────────────────────────┘

Docker Compose for Multi-Service IoT

docker-compose.yml manages entire stack:

yaml
version: "3.8"
services:
  mosquitto:
    image: eclipse-mosquitto:2.0
    ports:
      - "1883:1883"
    volumes:
      - ./mosquitto/config:/mosquitto/config
      - mosquitto_data:/mosquitto/data
    restart: unless-stopped

  collector:
    build: ./collector
    environment:
      - MQTT_HOST=mosquitto
      - INFLUX_HOST=influxdb
    depends_on:
      - mosquitto
      - influxdb
    restart: unless-stopped

  influxdb:
    image: influxdb:2.7-alpine
    volumes:
      - influx_data:/var/lib/influxdb2
    environment:
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=admin
    restart: unless-stopped

  grafana:
    image: grafana/grafana:10.2-alpine
    ports:
      - "3000:3000"
    volumes:
      - grafana_data:/var/lib/grafana
    restart: unless-stopped

volumes:
  mosquitto_data:
  influx_data:
  grafana_data:

Optimize Docker for Edge Devices

1. Multi-stage Build Reduces Image Size

dockerfile
# Build stage
FROM python:3.11-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt

# Runtime stage
FROM python:3.11-slim
COPY --from=builder /install /usr/local
COPY . /app
WORKDIR /app
CMD ["python", "collector.py"]

Image reduces from ~900MB to ~150MB — critical when deploying over 4G network.

2. Multi-arch Build for ARM64

Many edge devices (Raspberry Pi, NVIDIA Jetson) run ARM64:

bash
# Create buildx builder
docker buildx create --name iotbuilder --use

# Build for both AMD64 and ARM64
docker buildx build --platform linux/amd64,linux/arm64 \
  -t myregistry/collector:v1.2 --push .

3. Resource Limits

Edge devices have limited RAM, always set limits:

yaml
services:
  collector:
    deploy:
      resources:
        limits:
          memory: 256M
          cpus: "0.5"

CI/CD for IoT Fleet

Automatic Deployment Workflow

bash
# 1. Push code to GitHub
git push origin main

# 2. GitHub Actions builds and pushes image
# 3. On each device, Watchtower auto-updates

Use Watchtower for automatic image pulling:

yaml
services:
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_POLL_INTERVAL=300
      - WATCHTOWER_CLEANUP=true
    restart: unless-stopped

Code screen and container deployment terminal
Code screen and container deployment terminal

Container Security for IoT

  • Never run as root: use user: "1000:1000" in compose
  • Read-only filesystem: read_only: true for containers that don't write
  • Limit capabilities: security_opt: [no-new-privileges:true]
  • Secrets management: Docker secrets or .env file with chmod 600

For larger IoT fleet management, see Kubernetes for Robot Fleet with K3s and GitOps.

Monitoring and Logging

On edge devices, log rotation critical to avoid filling disk:

yaml
services:
  collector:
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

Docker and Docker Compose let you manage IoT applications professionally — from development to production, from single device to hundreds. Combined with CI/CD and auto-updates, deploy and maintain IoT fleet without SSH to each device.

Tool recommendations

Cloud/devops for robot fleets

Use for dashboards, APIs, logging, artifact storage, and monitoring.

VPS for ROS 2 / fleet dashboard backend Good for APIs, Postgres, workers, dashboards, and webhook automation. View VPS → Object storage for robot logs Store rosbag files, videos, datasets, and model artifacts with predictable cost. View storage → Cloud GPU for training jobs Keep training workloads off the robot so the robot only handles inference/deployment. View GPU →

Related Articles

  • Kubernetes for Robot Fleet: Orchestration at Scale
  • MQTT Protocol: Robot-Cloud Communication
  • Edge AI with NVIDIA Jetson: Deploy AI on Embedded Devices
NT

Nguyễn Anh Tuấn

Robotics & AI Engineer. Building VnRobo — sharing knowledge about robot learning, VLA models, and automation.

Explore VnRobo

Fleet MonitoringROS 2 IntegrationAMR Solutions
← Previous
AI Trends in Robotics 2025: From LLM to Embodied AI
Next →
Programming Robot Control with Python: From Basics to Advanced

Related Posts

Tutorial
Robotics
ros2monitoringrobot-fleet
other

How to Monitor ROS 2 Robots Remotely: Complete 2026 Guide

Step-by-step tutorial to monitor ROS 2 robots from anywhere — battery, CPU, status, heartbeat, alerts. Working code, 10-minute setup. Free for 3 robots.

4/14/20267 min read
NT
Comparison
Robotics
aws-robomakerrobot-fleetros2
other

AWS RoboMaker Alternatives 2026: 5 Platforms for ROS 2 Teams

AWS RoboMaker shut down in September 2025. Here are the 5 best alternatives for ROS 2 fleet management in 2026 — honest comparison, pricing, migration guide.

4/12/202611 min read
NT
Robotics
iotmqttcommunication
other

MQTT Protocol: Robot-to-Cloud Communication

MQTT protocol for robots and IoT — setting up brokers, QoS levels, topic design and sending telemetry from robots to cloud.

3/22/20264 min read
NT
VnRobo logoVnRobo logo

Learn Physical AI and experiment in your browser. Connect your fleet when you have real robots.

Product

  • Features
  • Pricing
  • Knowledge Base
  • Services

Company

  • About Us
  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 VnRobo. All rights reserved.

Made with♥in Vietnam