Skip to content

Getting started

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

This page takes one HTTP service from a plain compose file to its first zero-downtime bounce.

Install

docker-bouncer is a Docker CLI plugin: a single binary in ~/.docker/cli-plugins/ that the docker CLI runs as docker bouncer. It talks to the Docker Engine directly and embeds Compose, so it does not need the docker compose plugin.

Release assets are named docker-bouncer-<os>-<arch> for linux and darwin, amd64 and arm64. Set v to a release tag and bin to your platform. On macOS use shasum -a 256 -c instead of sha256sum -c.

mkdir -p ~/.docker/cli-plugins
curl -fsSL -o ~/.docker/cli-plugins/docker-bouncer \
  "https://github.com/cuza/docker-bouncer/releases/latest/download/docker-bouncer-$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
chmod +x ~/.docker/cli-plugins/docker-bouncer
docker bouncer --version

From source (Go toolchain required):

git clone https://github.com/cuza/docker-bouncer && cd docker-bouncer
go build -o ~/.docker/cli-plugins/docker-bouncer .

A first Service

Any HTTP service becomes a Bouncer Service by adding an x-bouncer block. By default Envoy checks GET / on the first port and any status below 500 passes; set healthcheck.uri to check a health endpoint that must answer 2xx (see Configuration).

# demo/compose.yaml
services:
  api:
    image: registry/app:1.0
    deploy: { replicas: 2 }
    restart: unless-stopped
    ports: ["127.0.0.1:8080:8080"]
    healthcheck:                     # optional; when present it must pass too
      test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"]
      interval: 5s
    x-bouncer: {}                    # all defaults: crossover, envoy drain

Notes:

  • Replica count is the standard deploy.replicas (default 1).
  • A Service needs ports: (published) or expose: (internal only).
  • restart: unless-stopped (or always) brings replicas back after a host reboot without a Bouncer run. The proxy always has it.
  • A Docker healthcheck is optional. Docker's default interval is 30 seconds, so set a short interval (or start_interval) or every new replica waits that long before it is put behind the proxy.

Start it:

cd demo
docker bouncer up

up pulls missing images (including the Envoy image), creates the proxy api with the published port, starts two replicas of api-app, adds them to Envoy's list, and returns once both pass Envoy's health check. Clients reach 127.0.0.1:8080 on the host, or api:8080 from other containers on the project's network, exactly as they would under plain Compose.

Checking it

docker bouncer ps
NAME             SERVICE   ROLE    REVISION   IMAGE                      STATE     HEALTH
demo-api-1       api       proxy   -          envoyproxy/envoy:v1.39.1   running   healthy
demo-api-app-1   api-app   live    1          registry/app:1.0           running   healthy
demo-api-app-2   api-app   live    1          registry/app:1.0           running   healthy
  • ls lists every project on the host that has Services, without needing the compose file:

    PROJECT   SERVICE   REVISION   REPLICAS   STATUS
    demo      api       1          2/2        converged
    
  • logs api shows all replicas, prefixed by container; logs api --proxy shows Envoy. Use --follow to stream (there is no -f: that is the global --file).

  • config prints the derived project Compose actually runs, including the generated Envoy config.

A first bounce

Change the image (or anything else in the service) and run up again:

sed -i.bak 's|registry/app:1.0|registry/app:1.1|' compose.yaml
docker bouncer up

With the defaults (crossover, bounce_overprovision_factor: 1.0, bounce_margin_factor: 0.95) and two replicas, Bouncer starts two 1.1 replicas next to the two 1.0 ones, adds each to Envoy's list as it starts (Envoy sends it nothing until its health check passes), and once a new replica has been healthy for min_task_uptime (10s) it drains an old one: off the list, wait for its open connections to finish (up to 60s), stop, remove. Capacity never drops below two healthy replicas. Run docker bouncer ps in another terminal to watch roles change from live to old/draining and new to live.

Running up again without changes does nothing: the running replicas already carry the desired spec hash.

docker bouncer history api
REVISION   TIME                   IMAGE              UP-ID
2 *        2026-10-03T12:05:00Z   registry/app:1.1   20261003T120500Z
1          2026-10-03T12:00:00Z   registry/app:1.0   20261003T120000Z

Roll back with undo; it bounces to revision 1's config as a new revision 3, and warns that the compose file still describes revision 2 (the next up rolls forward again):

docker bouncer undo

See Bounce methods to pick a different rollout shape and Operations for the rest of the commands.

Cleaning up

docker bouncer down

down removes the project's containers like docker compose down, including the proxy and every replica. Revision history lives on the replicas, so it is deleted too; the next up starts again at revision 1.

Clone this wiki locally