A fast, single-binary manager for a fleet of Docker Compose stacks — written in Go, talking straight to the Docker Engine API.
This is the v3.0 Go rewrite: the original was ~20k lines of Bash + Python shelling out to the docker CLI. It's now a single compiled Go binary that uses the Docker Engine API directly (with a CLI fallback), so it's dramatically faster and has no Python runtime to babysit.
Companion project:
stackd— a tiny boot orchestrator + watchdog that drivesstacksto bring up exactly the services you want at boot and keep them alive.
- Engine-API native — talks to
/var/run/docker.sockdirectly; falls back to the CLI when needed. - Per-stack, per-service control —
stacks up net_1 piholeworks as well asstacks up net_1. - Only-if-necessary by default —
up/repairare non-destructive;recreateforce-rebuilds;fixis the deep pass. Escalate only when something's actually wrong. - Traefik dynamics generator — emits one dynamic config per stack from your compose labels (routers, services, entrypoints, DB TCP routers, subdomain harvest).
- Sablier-style on-demand — services can be staged created-but-stopped and woken on first request.
- Image version history + rollback — per-image SQLite history (keeps the last N); roll back from the menu.
- Disk reclaim — tiered, on-demand-safe pruning of unused images/layers.
- Self-healing & dedupe — reconcile networks/IPs, strip duplicate service definitions, clean orphaned volume/network declarations.
- Multi-host — manage Docker on another machine (LAN or over the internet) from one
stacksinstance:stacks remote add/connect/ps, local↔public auto-swap, optional bastion hop, and a live host-switch (Ctrl+Rin the menu) that re-targets every tab. Runs natively on Linux and macOS. - 15-tab terminal UI —
stacks menu(Bubble Tea): Containers, Stacks, Networks, Settings, Updates, Images, Remotes, and more, with search and inline actions.
curl -fsSL https://raw.githubusercontent.com/crunkazcanbe/stacks-extended/master/install.sh | shGrabs the latest release binary for your OS/arch (Linux or macOS, amd64 or arm64) and sets up Docker + boot/watchdog services.
Building from source instead:
go build -o stacks ./bin/stacks
sudo cp stacks /usr/local/bin/
stacks versionRequires Docker (Engine API at the default socket). Go 1.25+ to build.
- Stacks live as individual Compose files in your stacks directory (default
/srv/stacks/Stacks, override with$STACKS_DIR) — e.g.net_1.yml,db_2.yml. - Config lives in
~/.config/stacks/stacks.yaml(resolved via$STACKS_CONFIG_DIR→ invoking user's home under sudo →$XDG_CONFIG_HOME→~/.config). It holdsstack_order, the always-onboot_stacks, and feature toggles.
stacks status # banner + container/stack overview
stacks ls # list all stacks
stacks menu # the full terminal UI
# lifecycle (per stack, optionally per service, with modifiers)
stacks up <stack> [service] [repair|recreate|fix|dynamics]
stacks down|start|stop|restart|recreate <stack> [service]
stacks heal | fixall # do-everything pass
# images & disk
stacks pull <stack> # pull images
stacks images # image version history / rollback
stacks reclaim # tiered disk reclaim (on-demand-safe)
stacks clean [-a] # prune
# routing & topology
stacks dynamics # (re)generate Traefik dynamic configs
stacks network | volume # inspect/manage
stacks dedupe | netdedupe # strip duplicate service / network decls
stacks purge service|stack … # remove + clean its orphaned net/volume decls
# misc
stacks logs|inspect|kill|rm <stack> [service]
stacks scale | proxy | snapshot | backup
stacks search <term> # image registry search
stacks update | upgrade # update history / self-update
# multi-host
stacks remote add <name> <local-ssh-target> <public-ssh-target>
stacks remote connect|disconnect|ps|status <name>
stacks remote autoswap <name> on|off # fall back to public when off-LAN
stacks remote proxy <name> <bastion> # optional extra SSH hop for public connections
Run stacks with no arguments for usage.
Everything lives in ~/.config/stacks/stacks.yaml. The keys worth knowing:
| Key | What it does |
|---|---|
stack_order |
The order stacks are brought up in. |
boot_stacks |
Always-on stacks — the boot orchestrator guarantees these and keeps them up. |
watch_heal_parallel |
How many containers the watchdog heals at once. 1 = strictly serial. |
zero_scale_parallel_sleep |
How many on-demand services are put to sleep concurrently. |
dynamics_dir |
Where the generated Traefik dynamic configs are written. |
Paths resolve via $STACKS_CONFIG_DIR -> the invoking user's home under sudo ->
$XDG_CONFIG_HOME -> ~/.config, so running under sudo still finds your config
rather than root's.
stacks is designed to be the only thing that starts containers. Docker's own
restart: always policies fight a boot orchestrator for control and leave you with
half-up stacks, so the boot path disables them and brings everything up in stack_order
instead. The watchdog then re-checks health on an interval and repairs only what is
actually broken — non-destructively first, escalating to recreate/fix only when a
gentler pass has already failed.
- One file per command —
status.go,up.go,fix.go,dynamics, etc. — so the codebase stays easy to navigate. dispatch.goparses<command> <stack> [service] [modifiers…]the same way the original Bash did, then routes to the lifecycle handlers.- API-first with CLI fallback keeps it fast on the happy path and robust everywhere else.
MIT