Skip to content

Operations

Dave Cuza edited this page Oct 3, 2026 · 10 revisions

Day-to-day use of the commands, and what to expect around interrupts, reboots and mistakes.

All commands that read the compose file take the same global flags as Compose: -f/--file, -p/--project-name, --project-directory, --profile, --env-file, plus --progress and --timestamps (see Output and CI).

up

docker bouncer up [SERVICE…] [--pull always|missing|never] [--force-unlock] [-d|--detach] [--wait]

up is always detached and always waits until every Service has converged or failed. There is no attached, log-streaming mode: a Ctrl-C there would stop the project, here it only stops the bounce. -d/--detach and --wait are accepted so docker compose habits and scripts work, and change nothing. In order:

  1. Load and validate the compose file and every x-bouncer block, and check that each SERVICE name exists. Errors exit 2.
  2. Pull the images it needs, before taking the lock (see Configuration). Errors exit 2.
  3. Take the lock <project>-bouncer-lock. If another run holds it, exit 1 with bounce in progress by ….
  4. Converge plain services and proxies through Compose, recreating only containers whose definition changed. Replicas are not touched here. If a proxy's own definition changed, it is recreated and a Proxy definition changed: recreating warning is shown first.
  5. Bounce every Service in parallel. For each one: start any stopped replicas, stamp a new revision only if the replica spec changed, wait up to a minute for the proxy's admin interface, then run the planner loop until the Service has converged or failed.
  6. Release the lock and exit 0 if every Service converged, 1 if any failed.

Running up twice with the same file is a no-op: no Service's spec hash changed, so each loop finds nothing to do.

All Services bounced by one run share an up-id, the run's UTC start time (20261003T120500Z). history shows it and undo uses it to find what the last run changed.

Scoping to services

With SERVICE names, up converges only those services and what they depend on, and bounces only the named Services. Other Services, even ones with a changed spec, are left alone. A name that is not a service in the file exits 2.

docker bouncer up api            # bounce api only
docker bouncer up api worker     # both, in parallel

stop

docker bouncer stop [SERVICE…] [-t/--timeout SECONDS]

docker compose stop on the derived project: dependents first, and a Service name covers its proxy and its replicas. There is no drain and no lock, so in-flight requests are cut; -t overrides each container's stop timeout. up brings everything back: Compose starts the proxies and plain services, and the bounce loop starts stopped replicas before deciding anything.

down

docker bouncer down

docker compose down of the derived project, including orphaned containers. It prints a warning first because revision history lives on the replicas and is deleted with them; the next up starts again at revision 1. It does not take the lock.

ps

docker bouncer ps

The project's containers with their role and revision:

Role Meaning
proxy the Service's Envoy proxy
live replica with the spec the compose file describes, in Envoy's list
new replica with the file's spec, not in Envoy's list yet (starting, or failing its Docker healthcheck)
old replica with another spec, still in Envoy's list
draining replica with another spec, off Envoy's list
- a plain Compose service

Roles compare each replica with the compose file, so after an undo the running replicas show as old: the file describes a different revision.

ls

docker bouncer ls

Every project on the host that has Services, read from container labels; no compose file is needed.

Column Meaning
REVISION highest revision among the Service's replicas
REPLICAS running replicas not marked unhealthy or starting by Docker / all replicas
STATUS bouncing if the project's lock container exists, else drifted if the replicas carry more than one spec, else converged

bouncing also shows for a lock left behind by a killed run.

history

docker bouncer history api
REVISION   TIME                   IMAGE                UP-ID
4 *        2026-10-03T12:30:00Z   registry/api:2.3     20261003T123000Z
3          2026-10-03T12:20:00Z   registry/api:2.2     20261003T122000Z
2          2026-10-03T12:10:00Z   registry/api:2.1     20261003T121000Z
1          2026-10-03T12:00:00Z   registry/api:2.0     20261003T120000Z

The current revision (marked *) and up to history_max earlier ones, newest first, read from the labels of a running replica. Without a running replica there is no history to show.

undo

docker bouncer undo [SERVICE] [--to-revision N]

Bounces back to a stored revision. The restored config becomes a new revision (a copy), so history only grows and an undo can itself be undone.

  • Without SERVICE, undo targets every Service changed by the last up or undo: those whose current revision carries the newest up-id. Services on their first revision are skipped with a Nothing to undo: first revision warning.
  • With SERVICE, only that Service. It must still be a Service in the compose file.
  • --to-revision N picks a stored revision; it must be in the history and not the current one. Default: the previous revision.
  • Env files are re-read now. Revisions store env_file paths, never their values, so the restored replicas get the files' current contents (current secrets). A required env file that no longer exists fails the undo.
  • The replica count is the file's current deploy.replicas, and the bounce uses the Service's current x-bouncer settings.
  • Images of the restored revision are pulled (when missing) before the lock is taken.
  • If another run changed the history between choosing the target and taking the lock, undo stops with revisions changed while undo started; run it again.

Before the bounce it shows, per Service, a warning such as:

Service api Revision 5 = copy of 3: the compose file still describes revision 4, the next up rolls forward

The compose file is not changed. The next up sees that the running spec differs from the file and bounces forward again. To stay on the old version, change the file to match it.

undo does not converge plain services or proxies and has no --force-unlock; if a lock left by a killed run blocks it, remove it with docker rm <project>-bouncer-lock once you are sure its owner is gone (up --force-unlock would take it over too, but then bounce to the file). See Troubleshooting.

logs, config, pull

  • logs SERVICE [--follow] [--proxy] [-n/--tail N]: all replicas of a Service, prefixed by container (--proxy for Envoy). For a plain service, its containers. --tail defaults to all lines. There is no -f; that is the global --file.
  • config: the derived project as YAML, starting with # derived by docker bouncer; not loadable by plain docker compose (the proxy entrypoint holds $BOUNCER_* variables that Compose would interpolate).
  • pull [SERVICE…]: pull every selected image and the proxy image; change nothing.

Output and CI

up, undo, pull, stop and down report progress through Docker Compose's own display, so Compose's steps (pull, create, start, recreate, stop, remove) look exactly as they do in docker compose, and Bouncer's steps appear in the same block:

Row Steps
Service api Bouncing (k/N) (k replicas of the new spec healthy), Converged, Failed: <reason>, warnings such as Proxy definition changed: recreating
Container <replica> Compose's Creating/Started, then Listed, Healthy; old ones Draining, Stopped (with the drain time), Removed
Lock <project>-bouncer-lock Acquired, Released (a warning if releasing fails)

--progress picks the renderer, with Compose's names:

Mode Output (stderr)
auto (default) tty on a terminal, plain otherwise (CI logs, pipes)
tty Compose's live-updating block with spinners and timers
plain one line per event: Service api Converged 2 replicas
json one JSON object per line
quiet errors only

--timestamps prefixes each plain line with an RFC 3339 UTC time:

2026-10-03T19:25:57.043Z Container demo-web-app-1 Draining
2026-10-03T19:25:57.211Z Container demo-web-app-1 Stopped drained 100ms
2026-10-03T19:25:57.485Z Service web Converged 2 replicas

json objects use Compose's JSON progress fields (id, status = Working/Done/Warning/Error, text, details) plus time (always), project, service, replica (for replica containers) and message:

{"time":"2026-10-03T19:26:08.155745Z","project":"demo","service":"web","id":"Service web","status":"Done","text":"Converged","details":"2 replicas","message":"Converged 2 replicas"}

In CI, use --progress plain --timestamps for readable logs or --progress json to parse; the exit code alone tells the outcome (0 converged, 1 failed, 2 configuration error, see Troubleshooting). NO_COLOR turns off colours, as in Compose.

The lock and interrupts

up and undo hold a per-project lock: a container named <project>-bouncer-lock, created from the proxy image with the labels bouncer.role=lock and bouncer.lock-owner=user@host pid N, and never started. Docker's unique container names make creating it atomic, so a second run fails with:

bounce in progress by alice@host pid 4242 since 2026-10-03T12:00:00Z (use --force-unlock if it is gone)
  • Ctrl-C or SIGTERM cancels the run cleanly: the current operation is abandoned, the lock is released, and the command exits non-zero. A second Ctrl-C kills it immediately.
  • SIGKILL (or a crash, or the host losing power) leaves the lock behind. It is taken over automatically once it is older than max(5m, bounce_health_timeout × number of Services) (the largest across the project), or immediately with up --force-unlock.
  • Resuming is safe. Every run starts from what is running: it rebuilds Envoy's list from the running replicas that pass their Docker healthcheck (putting a half-drained replica back on the list), and carries on. An interrupted bounce is finished by the next up.

stop and down do not take the lock; avoid running them during a bounce.

Reboots and restart policies

After a host or Docker restart, Docker restarts containers according to their restart policy:

  • the proxy always has restart: unless-stopped, and keeps the replica list Bouncer last wrote (it lives in the container, and the entrypoint only seeds a list when none exists);
  • give Services restart: unless-stopped (or always) so their replicas come back too.

Replicas get new IP addresses, but Envoy resolves their container names every second, so traffic flows again as soon as they answer their health check, without a Bouncer run.

Replicas without a restart policy stay stopped; the next docker bouncer up starts them before it decides anything else.

Recovering from plain docker compose up

Plain docker compose up on a Bouncer project is unsupported. Compose sees api as the ordinary service from your file, so it recreates api from your file as the app itself, taking the proxy's place and its ports. The replicas are left running but receive no traffic.

To recover, run docker bouncer up. It recreates api as the proxy (a brief interruption), rebuilds Envoy's list from the running replicas, and bounces only if the spec changed. Use docker bouncer stop, down, logs and ps instead of their Compose equivalents.

Clone this wiki locally