docker-hello.sh

Arduino Portenta X8 · File : docker-hello.sh · Language : Bash · Use case : Lancer un conteneur Docker sur la carte (signature X8)

The X8 is the Arduino board that runs Docker: this script checks the engine, deploys a containerized web server with auto-restart and tests it with curl. Containerized apps sit beside Arduino real-time.

Hardware

An Arduino Portenta X8 (ST STM32MP1 module: quad Cortex-A7 Linux + dual Cortex-M4 real-time core, 8 GB eMMC, 2 GB LPDDR4, on-board Wi-Fi/BT, optional LTE). None; network to pull the image (or a local registry).

Wiring

Nothing to wire. The board must be on the network to pull the image.

How it works

docker run -d detaches the container, --restart relaunches it after reboot, -p publishes the port. curl validates the local HTTP reply.

Running it

Linux side: SSH access (routed USB-C or network) on the Portenta Linux image, bash/Python scripts. Real-time side: Arduino IDE with the « Arduino Mbed OS Portenta X8 Boards » core, application M7 core, flashing via mboot from Linux.

Variants

Deploy your own Python service in a container, or orchestrate several microservices with embedded docker compose.

docker-hello.sh

#!/bin/bash
# Docker embarque : la signature applicative de la Portenta X8.
# Verifier la presence du moteur puis lancer une charge utile utile.

if ! command -v docker >/dev/null; then
  echo "Docker absent : activer le composant container de l'image X8"
  exit 1
fi

docker --version
docker info --format 'stockage: {{.Driver}}  noyau: {{.KernelVersion}}'

# Petit service web embarque (image ARM compatible X8).
docker run -d --name webtest --restart unless-stopped \
  -p 8080:80 nginx:alpine || {
    echo "verifier l'architecture de l'image (arm)"; exit 1; }

sleep 2
echo "Test HTTP local :"
curl -s -o /dev/null -w "code %{http_code}\n" http://localhost:8080/

echo
echo "Conteneurs : (docker ps)"
docker ps --format 'table {{.Names}}\t{{.Status}}'
# Nettoyage : docker rm -f webtest

← Back to the board