VnRobo
AboutPricingBlogContact
🇻🇳VISign InStart Free Trial
🇻🇳VI
VnRobo logo

AI infrastructure for next-generation industrial 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
VnRobo
AboutPricingBlogContact
🇻🇳VISign InStart Free Trial
🇻🇳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: Jun 16, 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:

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

Docker Compose for Multi-Service IoT

docker-compose.yml manages entire stack:

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

# 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:

# 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:

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

CI/CD for IoT Fleet

Automatic Deployment Workflow

# 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:

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:

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.

Khám phá VnRobo

Fleet MonitoringROS 2 IntegrationAMR Solutions

Related Posts

Tutorial
Robotics
ros2monitoringrobot-fleet
other

Cách giám sát robot ROS 2 từ xa: Hướng dẫn đầy đủ 2026

Hướng dẫn từng bước giám sát robot ROS 2 từ bất kỳ đâu — pin, CPU, trạng thái, heartbeat, alerts. Code chạy được, setup 10 phút. Miễn phí 3 robots.

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

AWS RoboMaker 2026: 5 lựa chọn thay thế cho đội ROS 2

AWS RoboMaker đã đóng cửa tháng 9/2025. Đây là 5 lựa chọn thay thế tốt nhất cho quản lý fleet robot ROS 2 năm 2026 — so sánh thẳng thắn, giá cả và hướng dẫn migration.

4/12/202611 min read
NT
Robotics
iotmqttcommunication
other

MQTT Protocol: Giao tiếp giữa robot và cloud

MQTT Protocol cho robot và IoT — thiết lập broker, QoS levels, topic design và truyền telemetry từ robot lên cloud.

9/1/20254 min read
NT
VnRobo logo

AI infrastructure for next-generation industrial 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