Running robot software in Docker and Compose with PhysicalFleet
Run the agent on the host and ship each machine role as one Compose project with pinned images and real health checks. Deploy it with compose.up: it waits until every service is healthy, and on any failure it returns the stack to exactly the images it ran before, without pulling.
Agent on the host, your software in Compose
Containers give every machine a declared, versioned set of services. PhysicalFleet understands Compose projects: it observes them service by service, deploys them with health checks, and rolls them back to the exact images they ran before. The setup that gets the most out of it with the least effort is the agent on the host and your robot software as one Compose project per machine role.
Machine (Ubuntu, Debian or JetPack)
├── PhysicalFleet agent and Guardian (host, systemd)
├── Docker Engine + Compose v2
│ └── Compose project "cell" /opt/cell/compose.yaml
│ ├── driver (ROS 2 hardware drivers: host network, devices)
│ ├── perception (ROS 2 cameras and detection, GPU)
│ ├── policy (VLA or RL policy, GPU)
│ └── bridge (MES or cloud integration)
└── /opt/models/<name>/current (model weights, switched atomically)- Why the host. From the host the agent sees the hardware, every container, the ROS graph and security events, and it can update everything else, including Docker itself.
- Why one project per role. A picker, an AMR and a gateway each get their own compose file, so a release deploys and rolls back one role as a unit and every machine of that role is identical.
- Containers without an init system can run the agent as their main process instead. The command is in the docs in the dashboard. Use it for container-only targets, not for robots you own end to end.
Check it. Shortly after installing, Observability › Software › Services lists each container, grouped by Compose project and service. On the robot, sudo pfagent discover prints the machine map PhysicalFleet sees, containers included.
What PhysicalFleet sees in every container, with no setup
The agent reads Docker (rootful and rootless) the moment it starts. Podman containers and Kubernetes pods on k3s are observed too. Nothing runs inside your containers for this.
| Data | Details |
|---|---|
| Inventory | Name, image and image version, state, health, restarts and restart policy, exit code, killed for memory, Compose project, service and file, ports, mounts, devices passed in (cameras, serial adapters, GPUs), privileged, host network, and the platform when an image runs under emulation. Commands are shown with secrets masked |
| Metrics | Running or not, Docker's restart count, CPU and memory per container |
| Events | A container died, was killed, ran out of memory, restarted, started, or changed health |
| Logs | Every container's output, masked on the machine and folded into patterns (see below) |
| Change timeline | Container images added, removed or changed, including changes made while the agent was off |
In Observability › Software › Services › Containers, each container becomes a row with these parameters:
| Parameter | What it flags |
|---|---|
| Health | Healthy, No health check, Starting, Unhealthy or Not running |
| Up time | Share of the window the container ran: down, down at times, up |
| Restarts | Docker's restart count: a warning from 3, critical from 10 |
| Exits and kills | Times it died, was killed or ran out of memory in the window |
| CPU and Memory | What each container uses |
| Image version | Whether it runs the same image version as most machines running it |
| Isolation | Privileged containers and containers on the host network |
| Last exit | Containers that stopped with an error or were killed for memory |
| Errors logged | Error lines each container wrote in the window |
Whole fleet shows one row per container across machines with the spread, so an image that differs from the rest of the fleet stands out. By machine shows one row per machine.
A Compose file the fleet can observe, update and roll back
# /opt/cell/compose.yaml
name: cell
x-logging: &logging
driver: json-file # json-file, local or journald: logs PhysicalFleet can read
options: {max-size: "10m", max-file: "3"}
services:
driver:
image: ${REGISTRY}/arm-driver:${TAG}
restart: unless-stopped
network_mode: host # ROS 2 discovery on the host network
ipc: host
devices:
- /dev/ttyUSB0:/dev/ttyUSB0 # motor bus
environment:
ROS_DOMAIN_ID: "10"
command: ["ros2", "launch", "arm_bringup", "arm.launch.py"]
healthcheck:
test: ["CMD", "/healthcheck.sh"] # talks to the motors, not just pgrep
interval: 5s
retries: 3
start_period: 30s
logging: *logging
policy:
image: ${REGISTRY}/policy:${TAG}
restart: unless-stopped
network_mode: host
ipc: host
volumes:
- /opt/models/policy:/models:ro # weights, switched by the AI model block
environment:
ROS_DOMAIN_ID: "10"
command: ["python3", "-m", "policy.run", "--weights", "/models/current"]
healthcheck:
test: ["CMD", "curl", "-fs", "http://127.0.0.1:8080/health"]
interval: 5s
retries: 3
start_period: 60s
logging: *logging
bridge:
image: ${REGISTRY}/cell-bridge:${TAG}
restart: unless-stopped
environment:
DB_PASSWORD: ${DB_PASSWORD} # from .env, filled by the release
logging: *logging- Pin versions, never
:latest. Use a version tag or a digest. With:latest, machines that pull at different times run different builds, and a rollback has nothing exact to go back to. The release builder warns about:latest. - Name the project with
name:(or the release'sproject) so it is the same on every machine. The dashboard groups containers by project and service. - Use the host network for ROS 2, with
ipc: hostfor shared-memory transport. It keeps DDS discovery simple and lets the agent see the ROS graph with no extra setup. - Keep secrets out of images and compose files. Reference them as
${VAR}and fill the.envfrom the release with{{secret:NAME}}. They are fetched on the machine at deploy time and never shown in output. - Keep big files outside the image. Model weights change on a different rhythm than code. Deploy them with the AI model block into a versioned folder and mount it read-only.
- Build images in CI, not on the robot. A
build:section on the robot means compilers on every machine and slightly different bytes on each one.
Health checks that test real work
compose.up succeeds only when every service is running, healthy, and has stayed up for 10 seconds. Without a health check, started is all it can know. A health check that tests real work turns a broken release into an automatic rollback instead of a broken robot.
- Drivers: check that the hardware answers (the motor bus responds, the camera delivers frames), not that the process exists.
- Services with an API: an HTTP endpoint that runs a cheap real request, such as a dry inference.
- Loops with no API: have the main loop touch a heartbeat file and check its age.
- Set
start_periodlong enough for model loading and calibration, so a slow start isn't counted as a failure. - One-shot services that exit cleanly, such as migrations, are fine. A crash-looping service fails the step with its last error line.
healthcheck:
# the app touches /tmp/heartbeat from its main loop; fail if older than 5 s
test: ["CMD-SHELL", "test $$(( $$(date +%s) - $$(stat -c %Y /tmp/heartbeat) )) -lt 5"]
interval: 5s
timeout: 2s
retries: 3
start_period: 30s# in the app's main loop
from pathlib import Path
HEARTBEAT = Path("/tmp/heartbeat")
while running:
step()
HEARTBEAT.touch()What you'll see. The Containers table's Health column shows Healthy, Starting, Unhealthy, or No health check. Treat every No health check row as a service a release can't verify.
Deploy with compose.up
In the release builder, add a Docker › Compose stack › Deploy block: the file path, the compose file pasted or imported (from GitHub, for example), the .env values, the registry login, and a linked check such as an HTTP endpoint that reports the new version. Under the hood it is one compose.up step. This is the release's JSON view:
{
"variables": {"VERSION": "2.4.1"},
"preconditions": {
"min_free_mb": 2048,
"min_free_path": "/var/lib/docker",
"network": "unmetered",
"window": {"start": "22:00", "end": "05:00"}
},
"on_failure": "rollback",
"steps": [
{
"id": "stack",
"name": "Deploy the cell stack {{var:VERSION}}",
"type": "compose.up",
"file": "/opt/cell/compose.yaml",
"project": "cell",
"env": {
"REGISTRY": "123456789012.dkr.ecr.eu-west-1.amazonaws.com",
"TAG": "{{var:VERSION}}",
"DB_PASSWORD": "{{secret:DB_PASSWORD}}"
},
"auth": {
"type": "ecr",
"region": "eu-west-1",
"access_key_id": "{{secret:AWS_ACCESS_KEY_ID}}",
"secret_access_key": "{{secret:AWS_SECRET_ACCESS_KEY}}"
},
"timeout_s": 900
},
{
"id": "stack-check",
"type": "health.wait",
"check": {"type": "http", "url": "http://127.0.0.1:8080/version", "contains": "{{var:VERSION}}"},
"timeout_s": 180
}
]
}| Setting | Default | What it does |
|---|---|---|
file | required | Absolute path of the compose file on the machine |
content | The compose file itself, written to file | |
env | Written to .env next to the file; values may be {{secret:NAME}} or {{var:X}} | |
project | The Compose project name | |
services | all | Deploy only these services |
pull | true | Pull images before starting |
wait | true | Succeed only when every service is running, healthy and up for 10 seconds |
remove_orphans | true | Remove containers of services no longer in the file |
auth | Registry login (next sections) |
Both docker compose (v2) and docker-compose (v1) work. What happens when this runs: the machine waits for the window, 2 GB free on the Docker disk and a network that isn't cellular, pulling the images by digest ahead of time. In the window it deploys the stack. If /version doesn't report 2.4.1 within three minutes, the stack goes back to its previous images and the run ends rolled back.
For containers a compose file manages, prefer compose.up over container.replace. Compose recreates containers from the file on its next up, so a container replaced on its own drifts back.
Exact rollback, and how to rehearse it
Before compose.up changes anything, the agent tags the images the stack runs. If this step or any later step fails, the old compose file and .env come back, and the project returns to exactly those images under their own names, with nothing pulled. A mutable tag is pointed back too. A project that didn't exist before is taken down. Every step's undo record is saved before the step acts, so if the machine loses power mid-deploy, the agent finishes the rollback after it boots.
- Power cuts during
compose.up, duringcontainer.replaceand in the middle of a rollback are part of the field tests the agent passes. - One previous image per container or service is kept for rollback, and older ones are removed so disks don't fill up over many releases.
- Commands and scripts can't be undone automatically. If a release runs one, add an undo command to the block or a step in the If the release fails lane. The builder warns when a step has no undo.
Rehearse it. On one test machine, roll out a release whose check can't pass (for example, a contains value the new version doesn't report). Watch the rollout page: the step fails, the stack comes back, and the run ends rolled back. Then confirm on the machine:
docker compose -p cell images # the images the project runs now
docker compose -p cell ps # every service up and healthyConfidence in rollback is what lets you ship during the day. Repeat the rehearsal when you change the compose file's structure.
Registries, digests and always the newest version
Registry logins go in the step's auth, with credentials as {{secret:NAME}}. They never appear in output.
| Registry | Login |
|---|---|
| Docker Hub, GHCR, Azure ACR, GitLab, Harbor, Quay | basic: username, password, and server (none for Docker Hub) |
| Amazon ECR | ecr: region and an access key. The machine gets a fresh login token for each update |
| Google Artifact Registry and GCR | gcp: a service-account key (key_json) and server |
"auth": {"username": "acme-bot", "password": "{{secret:GHCR_TOKEN}}", "server": "ghcr.io"}Most teams build images every day. Instead of a new release per build, make one release that installs the newest version each time it is rolled out. In the builder, open Release settings › Newest versions and add an image source. A release can follow up to 10 sources: images from ECR, Docker Hub, GHCR or any OCI registry, S3 folders, GitHub release assets, Hugging Face files and Git branches.
- Options: a pattern for tags (
v2.*), and whether newest means most recently pushed (the default) or the highest version number.latestis never treated as a version, because it moves. - An image source named
VISIONgives{{var:VISION}}(the tag),{{var:VISION_IMAGE}}(repo:tag@sha256:..., pinned by digest) and{{var:VISION_DIGEST}}. - Use them in the compose file as
image: ${VISION_IMAGE}, withVISION_IMAGE={{var:VISION_IMAGE}}in the step'senv.
When a rollout starts, each source is pinned: an image by its digest, a file by its SHA-256. Every machine in the rollout installs exactly that, even if a new build is pushed halfway through. If a newer version appears between your review and Start, the wizard shows the review again, so nothing is installed unseen. Retry keeps the rollout's versions, and Roll back can reinstall the versions the release installed before.
Connections in OTA Updates › Artifacts › Connect a source only look versions up. Machines pull with their own registry login, set on the Docker block. You still start each rollout yourself: PhysicalFleet does not roll out new images automatically when they appear.
Roll out in phases, with a health gate
- Phases. Use Canary, then careful (1 machine, 10 %, 50 %, 100 %). The first machines cover every architecture, OS and init system you have. A phase stops when more than 20 % of it fails.
- Pull pressure. At most 200 machines update at once by default, so a large fleet never pulls the same image in the same second.
- Download ahead. While a machine waits for its maintenance window or a busy lock, images are pulled by digest, so nothing can start the new version early and the window is spent installing.
- Preconditions. Free disk on the Docker data folder (
min_free_mbwithmin_free_path), an unmetered network for big images, a battery level, a maintenance window. - Busy robots.
pf busy --reason "cycle" --for 30mon the host defers updates and reboots until the robot is free. - Health gate. After each phase and a soak (30 minutes by default) it compares updated machines against machines not updated yet on model latency, control and topic rates, cycle yield, errors and new issues, and stops the rollout when something gets more than 20 % worse.
Mixed fleets. Publish multi-architecture images, so one tag serves arm64 and amd64 machines. An amd64 image on an arm64 robot runs under emulation and is much slower: the container inventory shows the platform when that happens. When a service exists only on some machines, limit its step with when, for example {"arch": ["arm64"]} or {"tags": ["gpu"]}.
Preview on a machine before the first rollout of a new release. It reports missing images, secrets and disk space, and unreachable URLs, on a real machine, and changes nothing.
Logs from Docker
The agent follows the output of every running container whose log driver keeps it readable: json-file and local. Containers that log to journald arrive through the journal. Other drivers (syslog, fluentd, none) are not read, so their logs never reach PhysicalFleet.
- Lines arrive in Debugging › Logs › System with the source
docker:<container>. Filter by machine, severity and source, or follow them live. - Secrets are masked on the machine before anything leaves it: passwords, tokens, API keys, authorization headers, JWTs, credentials in URLs, cloud keys, private keys and card numbers.
- Repeated lines fold into patterns with a count, so a flood of one message is one row and the rare line stands out. Warnings and errors are always sent as they are.
- Severity is read from each line's text. Put the level word (ERROR, WARN, INFO) in every line.
- Analysis is capped at 1,000 info lines and 3,000 lines in total per second per machine. The rest is counted, and the security watchdogs still see every line.
For richer logs from Python, with code locations and trace ids, use the library's pf.capture_logs() in your app, or add the app's log files in Debugging › Logs › Apps (JSON lines are parsed, and multi-line stack traces are joined).
Rotate container logs (max-size, max-file above). An unrotated json-file log is one of the most common ways a robot's disk fills up.
GPU containers and models in containers
On x86 machines with an NVIDIA GPU and the NVIDIA Container Toolkit, reserve the GPU in Compose. On a Jetson, use runtime: nvidia:
policy:
image: ${REGISTRY}/policy:${TAG}
network_mode: host
ipc: host
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
# on a Jetson, instead of deploy:
# runtime: nvidia- The container inventory shows that a container has a GPU and which devices were passed in. GPU utilisation, memory, temperature and power come from the host every 30 seconds, and the accelerators list shows which processes use each GPU.
- NVIDIA library versions on the host, including the Container Toolkit, are device facts, and a machine on a different version than most of the fleet stands out.
- Python environments inside containers are listed with key packages (torch, onnxruntime, CUDA and cuDNN wheels) and conflicts, such as a pip package shadowing a conda one.
Model tracing in containers. Python processes in containers on the host network are traced automatically from their next start, with no code change. Containers on their own network are skipped, because the library sends JSON over UDP to the agent on the machine's loopback interface. Because a redeploy recreates the container, the most dependable setup is to mount the agent's bundled Python library into the container read-only and put it on PYTHONPATH. That gives the container the same instrumentation as pf run. The folder's path is in the docs in the dashboard.
Give the program a stable service name with python -m your_package or a fixed script name (a ROS 2 node's __node:= name works too), so the same model on 50 machines is one row in Observability › Software › Models.
Models outside the image. Ship weights with the AI model block and restart the service that loads them:
{
"variables": {"MODEL_VERSION": "2026-12-01"},
"on_failure": "rollback",
"steps": [
{"id": "weights", "type": "model.deploy",
"url": "https://models.example.com/policy-2026-12-01.tar.gz", "sha256": "<sha256 of the archive>",
"dest": "/opt/models/policy", "version": "{{var:MODEL_VERSION}}", "keep": 2},
{"id": "restart", "type": "exec", "cmd": "docker compose -f /opt/cell/compose.yaml restart policy"},
{"id": "check", "type": "health.wait",
"check": {"type": "http", "url": "http://127.0.0.1:8080/health", "status": 200}, "timeout_s": 120}
],
"rollback": [
{"id": "restart-old", "type": "exec", "cmd": "docker compose -f /opt/cell/compose.yaml restart policy"}
]
}On failure, current points back at the previous weights, then the rollback lane restarts the service on them. Weights can also come straight from Hugging Face, including private and gated models through a connected account.
Data and disk limits
Container logs and metrics count toward what a machine sends. Two settings, per machine or as fleet defaults in Settings › Organization › Fleet › Machine defaults, decide how much.
| Bandwidth level | Telemetry | Logs | Idle data a day |
|---|---|---|---|
| Very low | every 15 min | errors only | about 1 MB |
| Low | every 5 min | warnings and up | about 4 MB |
| Normal (default) | every minute | info and up | about 25 MB |
| High | every 30 s | more info lines | about 80 MB |
| Very high | every 10 s | debug and up | about 300 MB |
- Auto is Normal, or Low when the machine's internet goes through a cellular modem. For SIM plans, set a monthly data budget: the agent steps down while it spends ahead of the budget.
- Whatever the level, what a person asks for always works: terminal, commands, live camera, snapshots and requested recordings.
- Images pull from your registry straight to the machine, not through PhysicalFleet.
- The agent always leaves free space for your software (5 % of the disk or 64 MB, whichever is larger) and never deletes what it needs to roll back an update in progress.
- Built-in alerts fire when a disk is above 90 % for 5 minutes and above 98 %.
Add a docker.prune step at the end of a release, in the JSON view. what is a list of images (dangling, the default), unused_images, containers, volumes or build_cache. It never removes what a rollback needs, and after a Compose step in the same release the broader cleanups wait until the release has succeeded.
{"id": "cleanup", "type": "docker.prune", "what": ["unused_images"]}- Run the agent on the host, with one Compose project per machine role.
- Set name: in every compose file so the project is the same on every machine.
- Pin every image to a version tag or digest, never :latest.
- Give every service a health check that tests real work, with a start_period.
- Use network_mode: host (and ipc: host) for ROS 2 and for containers whose models you want traced.
- Keep secrets in .env, filled by the release with {{secret:NAME}}.
- Keep model weights outside images and mount them read-only.
- Use the json-file or local log driver with rotation, or journald.
- Deploy with compose.up and a linked check that the new version answers.
- Rehearse a rollback on a test machine before the first real rollout.
- Set a free-disk precondition on the Docker data folder and end releases with docker.prune.
- Roll out Canary then careful, with the health gate on.
:latest in production
Machines that pull at different times run different builds, and a rollback has nothing exact to return to. Pin tags or digests, or use newest-version releases that pin by digest per rollout.
Health checks that only test the process
A check that runs pgrep passes while the driver can't reach the motors. Test real work, so compose.up can tell a broken release from a working one and roll back.
Bridge networking for traced models
Automatic tracing skips containers on their own network, because the library talks to the agent over loopback. Run model containers on the host network.
A log driver PhysicalFleet can't read
Containers logging through syslog, fluentd or none never reach the dashboard. Use json-file or local with rotation, or journald.
amd64 images on arm64 robots
They run under emulation, slowly. Build multi-architecture images; the container inventory shows the platform when one runs emulated.
Replacing one container of a Compose project
Compose recreates containers from the file on its next up, so the change drifts back. Deploy Compose-managed containers with compose.up.
Letting old images fill the disk
Every pull adds images. End releases with docker.prune, set a free-disk precondition, and keep the built-in disk alerts on.
Written for PhysicalFleet as of December 3, 2026.
How does PhysicalFleet roll back a Docker Compose deploy?
Before compose.up changes anything, the agent tags the images the stack runs. If any step fails, it restores the previous compose file and .env and brings the project back on exactly those images, without pulling. If power is cut mid-deploy, it finishes the rollback after the machine boots.
Does it support Docker Compose v1 and v2?
Yes. Releases work with docker compose (v2) and docker-compose (v1). With wait on, the step succeeds only when every service is running, healthy and has stayed up for 10 seconds.
Which container registries can releases pull from?
Docker Hub, GitHub Container Registry, Azure ACR, GitLab, Harbor and Quay with a basic login, Amazon ECR with an access key (a fresh token per update), and Google Artifact Registry or GCR with a service-account key. Version lookup for newest-version releases works with any OCI registry.
Can a release always install the newest image?
Yes. Add an image source in Release settings › Newest versions. Each rollout pins the newest matching image by digest, so every machine gets the same bytes, and a newer build that appears before you start makes the wizard show the review again.
Should the agent run in a container?
Run it on the host where you can: from there it sees the hardware, every container and the ROS graph, and can update Docker itself. On targets without an init system, the agent can run as a container's main process.
Does it work with Podman or Kubernetes?
The agent observes Podman containers and Kubernetes pods on k3s as well as Docker. Release steps such as compose.up and container.replace drive Docker and Docker Compose.
Do I need to change my images to monitor the models inside them?
No. Python model processes in containers on the host network are traced automatically from their next start. For tracing that survives every redeploy, mount the agent's bundled Python library read-only and put it on PYTHONPATH; the docs in the dashboard give the path.
From the lab bench. To the entire fleet.
Connect your first machine in minutes, develop it in the lab and run your whole fleet in production from one place.
Free for up to 3 machines · Then pay as you go