Repository navigation
Operations
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).
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:
-
Load and validate the compose file and every
x-bouncerblock, and check that each SERVICE name exists. Errors exit2. -
Pull the images it needs, before taking the lock (see Configuration). Errors exit
2. -
Take the lock
<project>-bouncer-lock. If another run holds it, exit1withbounce in progress by …. -
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: recreatingwarning is shown first. -
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, re-apply the cluster settings in place if they changed (
Proxy config updated), then run the planner loop until the Service has converged or failed. -
Release the lock and exit
0if every Service converged,1if 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.
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 paralleldocker 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.
docker bouncer downdocker compose down of the derived project, including orphaned containers and the proxies and replicas of Services in inactive profiles. Plain services in inactive profiles keep running, as with docker compose down; pass --profile to remove them too. 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.
docker bouncer psThe 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.
docker bouncer lsEvery project on the host that has Services, one row per Service, read from container labels; no compose file is needed. Projects with only plain services are not listed: that is docker compose ls's job.
PROJECT SERVICE REVISION REPLICAS STATUS VERSION FORMAT CONFIG FILES
shop api 4 2/2 converged v0.3.0 1.0 /srv/shop/compose.yaml
shop worker 2 0/1 stopped v0.3.0 1.0 /srv/shop/compose.yaml
| 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 stopped if no replica is running, else converged
|
VERSION |
the Bouncer version that created the newest replicas, or - before versions were recorded |
FORMAT |
their storage format (see How it works), or -
|
CONFIG FILES |
the compose files the project was created from (Compose's com.docker.compose.project.config_files label, comma separated), or -
|
For a scheduled pull-and-bounce, use refresh. Format mismatches get a warning line on stderr after the table, the same ones the other read-only commands show: a newer or unparseable format, or a stack to migrate (project shop is at format none, this CLI writes 1.0; run docker bouncer migrate shop).
bouncing also shows for a lock left behind by a killed run.
docker bouncer history apiREVISION TIME IMAGE UP-ID VERSION
4 * 2026-10-03T12:30:00Z registry/api:2.3 (5e1d0c2b9a77) 20261003T123000Z v0.3.0
3 2026-10-03T12:20:00Z registry/api:2.2 (0f3c8e61d4a2) 20261003T122000Z v0.3.0
2 2026-10-03T12:10:00Z registry/api:2.1 (9b27a4f0e5c3) 20261003T121000Z -
1 2026-10-03T12:00:00Z registry/api:2.0 (77c1e9d03b58) 20261003T120000Z -
VERSION is the Bouncer version that made the revision, - before versions were recorded.
IMAGE is the image reference as written, plus, in parentheses, the start of the exact digest or image ID the revision was pinned to (see How it works). Revisions made before pinning show the reference alone.
The current revision (marked *) and up to history_max (default 100) earlier ones, newest first, read from the labels of a running replica. The history label is capped at 64 KiB; services with large specs may keep fewer (see history_max). Without a running replica there is no history to show.
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
uporundo: those whose current revision carries the newest up-id. Services on their first revision are skipped with aNothing to undo: first revisionwarning. - With SERVICE, only that Service. It must still be a Service in the compose file.
-
--to-revision Npicks a stored revision; it must be in the history (by default the last 100) and not the current one. Default: the previous revision. -
Env files are re-read now. Revisions store
env_filepaths, 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 currentx-bouncersettings. -
The restored revision runs its exact image, the one recorded in its
dev.cuza.bouncer.imagelabel, not whatever its tag names now: arepo@sha256:…is pulled (when missing) before the lock is taken; an image ID (a built or locally tagged image) cannot be pulled and must still be on the host, otherwise undo fails naming the missing image and the revision. The restored replicas show that digest or ID as their image inps. Revisions made before pinning run their image reference, as before. - 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.
docker bouncer refresh [PROJECT…] [-a|--all] [--dry-run] [--pull never]A Watchtower replacement for cron. For every project on the host with Bouncer replicas (as ls lists them), or the named ones (an unknown name exits 2), refresh:
- loads the project exactly as its last
updid, from the invocation on the replicas of its newest up-id: same compose files, project directory, env files and profiles, whatever the current directory. Variables the compose files took from the shell are not replayed; it warnsvalues from the shell at the last up are not replayed; put them in an env file; - pulls, as
pull_policy: always, every tagged image of the Services it converges, so a moved tag arrives; digest references are left alone,pull_policy: never/buildis honoured, andbuild:services are not rebuilt (it says so).--pull neveruses the local images; - runs
up's code path on the project's Services: image pinning makes an unchanged image a no-op and a moved tag a health-gated, zero-downtime bounce.
Plain services are only touched with -a: then they are converged as docker compose up does, so a plain service whose image changed is recreated (a brief restart), and a stopped one started; a created, recreated or started plain service or proxy makes the project Refreshed. Without -a, plain services are never created, recreated or started, and proxies are left as they are.
Undo holds. A Service whose current revision came from undo is not bounced: Service api Held at revision 3 by undo; run docker bouncer up to resume. The next up releases it.
Skips. A project whose lock is held is skipped (Skipped: bounce in progress by …), never waited for or forced; the format is checked again once the lock is held, as for up. So is a project with no replica running, and one whose replicas predate invocations (no invocation recorded; run docker bouncer up once).
--dry-run reports per Service what would change and changes nothing. For Services: Would bounce: image registry/api:2 moved from … to …. For plain services and proxies it models what -a would have Compose do: Would create (no container), Would start (stopped), Would recreate (Compose's config hash changed, or a plain service's image moved); without -a these read Would … with -a and don't count as a change. Instead of pulling, it asks the registry for the tag's manifest digest (docker manifest-style, through the Docker daemon), only for images refresh would pull (not pull_policy: never/build, digests or build: services); a failed lookup fails that project (exit 1). With --pull never it compares the local images with the running ones.
Output. Each project gets a Project <name> row (Up to date, Pulled, Bouncing, Refreshed, Skipped: …, Failed: …), with Bouncer's usual Service and replica rows during a bounce, then a summary such as 3 projects: 1 refreshed, 1 up to date, 1 skipped. In --progress json every object has project (and service where relevant); the summary is the last object, with ID Refresh and an empty project.
Exit code. Projects are refreshed one after another and a failure doesn't stop the others: 0 when every project was refreshed, up to date or skipped, 1 when one failed, 2 for a usage or config error.
*/15 * * * * docker bouncer refresh --progress plain --timestamps >> /var/log/bouncer-refresh.log 2>&1docker bouncer migrate [PROJECT…] [--dry-run]Brings projects stored in an older format, or none, to this CLI's. Per project it takes the lock, runs the stored specs, history and invocation through the migration chain and stores the result, and re-bounces every Service from its current revision, with its exact image and no build or pull, so the new replicas carry the new format; the revision number and history stay. Plain services are left alone. A stopped project, or a Service with no running replica, is skipped with the reason (start it with up, then migrate). A project already at the CLI's format is Up to date, so running it again does nothing; a newer one is refused (no downgrades), as is one with a format label this CLI can't parse, or one below the minimum readable major. --dry-run lists the steps and the Services that would bounce. Projects from before invocations were recorded are loaded from the current directory and -f, like up. Exit codes as refresh. --ignore-format does not apply.
-
logs SERVICE [--follow] [--proxy] [-n/--tail N]: all replicas of a Service, prefixed by container (--proxyfor Envoy). For a plain service, its containers.--taildefaults 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.
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>, Proxy config updated, 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.
up and undo hold a per-project lock: a container named <project>-bouncer-lock, created from the proxy image with the labels dev.cuza.bouncer.role=lock and dev.cuza.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 withup --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.
A Service's pre_start hooks run as they would under Compose for a recreated service: once, before the first replica of a new revision starts.
- On the first
up, with no replica running, Compose runs them itself. - On a bounce (from
up,undo,refreshormigrate), the old replicas keep running, and Compose only runs hooks when none does, so Bouncer runs them: it creates the new replica, then each hook in order, in a container made by Compose from the hook's spec (<project>-<service>-app-pre_start-<n>) that shares the new replica's volumes, then starts the replica. A scale-up within the same revision runs no hooks. - A hook that exits non-zero fails the bounce with its exit code and its last 20 lines of output (
api-app pre_start[0]: exited with 3:followed by the output), removes the replicas it created, with their anonymous volumes, and leaves the old ones serving;upexits1. - The hook's container is always removed, whether the hook succeeds, fails or the run is interrupted (Ctrl-C stops a running hook); the volumes it shares with the replica are left alone.
- Hooks do not get the Service's network aliases, as the replicas do not: the aliases resolve to the proxy only.
- On
undoandmigrate, a hook that inherited the service's image runs the revision's exact image.
A provider: service's injected variables (<PROVIDER>_<KEY>, or raw keys) reach the replicas of a Service that depends_on it, as they reach a plain dependent. up runs a provider when it converges plain services, as docker compose up does, and again on each bounce step that creates replicas of a Service depending on it (Compose injects the values only into the replicas created alongside the provider run). A bounce in several steps runs the provider several times; pre_start hooks and starting replicas do not run it. The values are not part of the spec, so a provider returning new values does not bounce a Service by itself; they apply to the replicas created by its next bounce.
deploy.replicas: 0 drains and removes every replica. A Service's revision history lives in its replicas' labels, so it goes with them: up warns Scaling to 0 replicas: history lives on the replicas and is lost at 0. The next up with replicas starts again at revision 1, and history and undo have nothing older. To pause a Service and keep its history, use docker bouncer stop instead.
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(oralways) 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.
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.