# docker-stacks-update Finds all running Docker Compose stacks, pulls the latest images, and restarts only the stacks that received updates. ## Requirements - **docker** (with Compose v2 plugin — `docker compose`, not `docker-compose`) - **jq** — used to parse the JSON output of `docker compose ls` ## Installation Place the script anywhere in your `$PATH`, for example: ```bash cp docker-stacks-update ~/.local/bin/ chmod +x ~/.local/bin/docker-stacks-update ``` ## Usage ```bash docker-stacks-update ``` Run from any directory — the script finds every running stack system-wide using `docker compose ls`. ## What it does 1. **Discover** — lists all running stacks with `docker compose ls --format json` 2. **Pull** — runs `docker compose pull` for each stack 3. **Detect** — checks whether any service image was actually downloaded (not just "already up to date") 4. **Restart** — recreates containers with `docker compose up -d` only for stacks that received new images 5. **Orphan cleanup** — any stack whose compose file(s) no longer exist on disk is torn down automatically 6. **Report** — prints a summary showing updated (with service names), unchanged, orphaned (removed), and failed stacks