Restart policies
This article refers to Platform v3.1.0. The current Platform version is v3.2.0.
Overview
A Docker restart policy tells the runtime what to do when a container stops. Picking the right policy is the difference between an app that self-heals from a transient crash and one that needs manual intervention every time. This article covers the four policies, the one that Barbara does not allow, and the right defaults.
Available restart policies
Docker Compose supports four values for the restart: directive:
| Policy | Behaviour |
|---|---|
no (default) | The container is not restarted automatically when it stops. |
unless-stopped | The container is restarted unless an operator manually stopped it. |
on-failure | The container is restarted only when it exits with a non-zero exit code. Accepts an optional max-retries count. |
always | The container is restarted no matter what — including after a clean shutdown. |
The always policy is forbidden on Barbara edge nodes. Use unless-stopped instead — it survives crashes and reboots while still letting an operator stop the workload from Panel.
Compose syntax
version: '3.8'
services:
filebrowser:
image: filebrowser/filebrowser:latest
ports:
- "8080:80"
restart: unless-stopped
With restart: unless-stopped:
- The container restarts after a crash.
- The container restarts after the node reboots.
- The container does not restart after an operator stops it from Panel — that intent is preserved.
Recommended defaults
- Long-running services (brokers, databases, web UIs) —
restart: unless-stopped. - One-shot jobs (migrations, batch processors that exit on completion) —
restart: noorrestart: on-failure. - Anything else — pick
unless-stoppedunless you have a specific reason otherwise.
Summary
unless-stopped is the right default for almost every long-running workload on a Barbara edge node. Use on-failure for jobs that have a defined end. Never use always — it is rejected by the Barbara agent.