DockerSelf-Hosting

docker rollout with Docker Compose: Update a Service with Zero Downtime (Linux, Windows, Mac)

Before you start

  • 18 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

docker rollout is a free Docker CLI plugin (one shell script) that replaces docker compose up -d <service>: it starts a second copy of your service, waits until the copy is healthy, and only then removes the old one, so visitors do not see a gap while your app restarts.

docker rollout title card (no official logo)

Image: DIY Lab Hub title card. docker rollout has no official logo.

It suits one server with Docker Compose and a reverse proxy in front, for example a homelab app that takes 20 seconds to boot. It is not an orchestrator: it overlaps the old and the new container for a short time, and that is all.

WhatValue (official sources, read 3 December 2026)
Current versionv0.14, released 12 July 2026 (previous: v0.13, 25 July 2025)
What we installThe script at tag v0.14 (never the moving main branch)
LicenceMIT (LICENSE at the repository)
NeedsDocker with Compose v2, a reverse proxy that finds containers by itself, a healthcheck
Time neededAbout 30 minutes (our estimate, not measured)
PortsNone of its own. The proxy owns 80 and 443
Official docsdocker-rollout.wowu.dev

At a glance:

  • What it replaces: docker compose up -d web becomes docker rollout web.
  • How: scale to twice the containers, wait for health, remove the old ones.
  • Safety net: if the new container never gets healthy, it is removed and the old one keeps serving.
  • Must have: no container_name, no published host ports on the service, a proxy that finds containers by itself (Traefik or nginx-proxy are the documented ones), and a healthcheck.
  • Careful: two versions of your app run together for a few seconds, so database changes must work with both.

How it fits together#

The script asks Compose for twice as many containers without touching the old ones, waits for Docker to call the new ones healthy, optionally tells the old ones to stop taking requests, then stops and removes them. The reverse proxy follows the health status, so traffic moves over by itself.

docker rollout flow: step 1 scales the web service to twice the containers and keeps the old ones, step 2 waits for the Docker healthcheck, step 3 runs the optional pre-stop hook and removes the old containers; the reverse proxy routes to the new container once it is healthy and visitors reach the proxy over HTTPS; if the new container is not healthy in time it is removed and the old one keeps serving

Drawn for this guide from the official docs and the script at v0.14. The dashed box is the failure path.

Three words. A healthcheck is a command Docker runs inside the container every few seconds; the result is healthy or unhealthy. A reverse proxy is the one front door (ports 80 and 443). Draining means the old container stops taking new requests while it finishes the ones it has.

Before you start#

Note: every domain, password and key on this page is a dummy example (app.example.com, change-me). Replace it with your own.

You need an always-on machine with Docker and a running reverse proxy. We use Traefik as set up in our Traefik guide: the proxy network, the entrypoints http and https, and the certificate resolver le.

SystemWhat to have
LinuxDocker Engine and the Compose v2 plugin
WindowsWindows 10 or later, Docker Desktop with the WSL 2 engine, a Linux distribution in WSL, PowerShell. The plugin is a shell script, so it runs inside WSL (Step 1 explains why)
MacDocker Desktop, Intel or Apple Silicon
Run in terminalbash
docker --version
docker compose version

Checklist:

  • [ ] docker compose version prints a version
  • [ ] Traefik runs and the proxy network exists (docker network ls)
  • [ ] A domain with DNS to the server and ports 80 and 443 open (HTTPS section only; at home use Caddy with tls internal)
  • [ ] Your app is stateless, or you know how it behaves with two copies at once
  • [ ] Your Compose files are backed up

Tested by DIY Lab Hub: not yet. Commands come from the official docs, the v0.14 script and the Compose and Traefik sources (3 December 2026). We ran nothing on a real machine, so every "expected" output is derived from the script text.

Step 1: Install the plugin (pinned to v0.14)#

A Docker CLI plugin is an executable named docker-<name> in a plugin folder. The official docs download from a moving branch. We download the tag v0.14 and check its SHA-256, a fingerprint we computed from that file on 3 December 2026.

Linux#

Run in terminalbash
mkdir -p ~/.docker/cli-plugins
curl -fSL https://raw.githubusercontent.com/wowu/docker-rollout/v0.14/docker-rollout \
  -o ~/.docker/cli-plugins/docker-rollout
echo "cdeaba6ae9eee3b0b606286e585bbda6787283d801a6ad6d9b9d2bc347fda05b  $HOME/.docker/cli-plugins/docker-rollout" | sha256sum -c -
chmod +x ~/.docker/cli-plugins/docker-rollout
docker rollout --version

With sudo docker or for all users, use /usr/local/lib/docker/cli-plugins/ instead (docs).

Windows (PowerShell)#

Docker on Windows only accepts plugins ending in .exe (Docker CLI source), and this plugin is a /bin/sh script. So it lives in your WSL distribution and PowerShell calls it through wsl. Turn on Docker Desktop's WSL integration for that distribution first.

Run in terminalpowershell
wsl sh -c 'mkdir -p ~/.docker/cli-plugins && curl -fSL https://raw.githubusercontent.com/wowu/docker-rollout/v0.14/docker-rollout -o ~/.docker/cli-plugins/docker-rollout && chmod +x ~/.docker/cli-plugins/docker-rollout'
wsl sh -c 'sha256sum ~/.docker/cli-plugins/docker-rollout'
wsl docker rollout --version

The checksum must equal the one in the Linux block. This is our own reading of the sources; upstream does not claim Windows support and we did not run it. If wsl gives trouble, open the WSL terminal and follow the Linux steps.

Mac (Terminal)#

Run in terminalbash
mkdir -p ~/.docker/cli-plugins
curl -fSL https://raw.githubusercontent.com/wowu/docker-rollout/v0.14/docker-rollout \
  -o ~/.docker/cli-plugins/docker-rollout
shasum -a 256 ~/.docker/cli-plugins/docker-rollout
chmod +x ~/.docker/cli-plugins/docker-rollout
docker rollout --version

The shasum value must equal the one in the Linux block. The release notes record a macOS fix in v0.7.

Check it worked. docker rollout --version prints docker-rollout version v0.14. If Docker says docker: 'rollout' is not a docker command, the file is in the wrong folder or not executable.

Tip: Uninstalling is one command: rm ~/.docker/cli-plugins/docker-rollout. Nothing else is left (docs).

Step 2: Create the folders and the settings file#

Everything lives under ~/docker_volumes/docker-rollout. The three values in .env are names we chose; Compose reads them. An update becomes a one-line edit.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/docker-rollout/{data,config,logs,backups}
cd ~/docker_volumes/docker-rollout
cat > .env << 'EOF'
APP_TAG=1.29.3-alpine
APP_HOST=app.example.com
HEALTH_PATH=index.html
EOF
chmod 600 .env

app.example.com is a dummy: replace it with your own name. The public nginx image stands in for your app; its alpine flavour has the sh and wget the healthcheck needs.

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\docker-rollout"
foreach ($d in "data","config","logs","backups") {
  New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location $base
@'
APP_TAG=1.29.3-alpine
APP_HOST=app.example.com
HEALTH_PATH=index.html
'@ | Set-Content -Encoding ascii .env

Mac (Terminal)#

Same commands as Linux.

Check it worked. cat .env (Windows: Get-Content .env) shows three lines.

Step 3: Write the Compose file#

The file follows the plugin's rules: no container_name, no ports, a healthcheck, and Traefik labels.

Linux#

Run in terminalbash
cd ~/docker_volumes/docker-rollout
cat > compose.yaml << 'EOF'
services:
  web:
    image: nginx:${APP_TAG}
    restart: unless-stopped
    networks:
      - proxy
    healthcheck:
      test: ["CMD-SHELL", "test ! -f /tmp/drain && wget -q -O /dev/null http://127.0.0.1/${HEALTH_PATH} || exit 1"]
      interval: 5s
      timeout: 3s
      retries: 1
      start_period: 5s
    labels:
      - traefik.enable=true
      - traefik.docker.network=proxy
      - "traefik.http.routers.rollout-demo.rule=Host(`${APP_HOST}`)"
      - traefik.http.routers.rollout-demo.entrypoints=https
      - traefik.http.routers.rollout-demo.tls=true
      - traefik.http.routers.rollout-demo.tls.certresolver=le
      - traefik.http.services.rollout-demo.loadbalancer.server.port=80
      - "docker-rollout.pre-stop-hook=touch /tmp/drain && sleep 15"

networks:
  proxy:
    external: true
EOF

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\docker-rollout"
@'
services:
  web:
    image: nginx:${APP_TAG}
    restart: unless-stopped
    networks:
      - proxy
    healthcheck:
      test: ["CMD-SHELL", "test ! -f /tmp/drain && wget -q -O /dev/null http://127.0.0.1/${HEALTH_PATH} || exit 1"]
      interval: 5s
      timeout: 3s
      retries: 1
      start_period: 5s
    labels:
      - traefik.enable=true
      - traefik.docker.network=proxy
      - "traefik.http.routers.rollout-demo.rule=Host(`${APP_HOST}`)"
      - traefik.http.routers.rollout-demo.entrypoints=https
      - traefik.http.routers.rollout-demo.tls=true
      - traefik.http.routers.rollout-demo.tls.certresolver=le
      - traefik.http.services.rollout-demo.loadbalancer.server.port=80
      - "docker-rollout.pre-stop-hook=touch /tmp/drain && sleep 15"

networks:
  proxy:
    external: true
'@ | Set-Content -Encoding ascii compose.yaml

Mac (Terminal)#

Same commands as Linux.

What the important lines do:

LineWhy
No container_name, no portsTwo copies must run side by side
healthcheckThe plugin waits for healthy. Without one it only sleeps 10 seconds and hopes
test ! -f /tmp/drain && ...The drain switch: while /tmp/drain exists the check fails on purpose, so the proxy stops sending requests there
interval: 5s, retries: 1Unhealthy within 5 seconds of the file appearing (the official draining recipe)
entrypoints=https, tls.certresolver=leTraefik answers on 443 with a Let's Encrypt certificate
docker-rollout.pre-stop-hookRuns in the old container before it stops: creates the drain file, waits 15 seconds

Why 15? The docs say the sleep must exceed the healthcheck interval times retries plus the time your longest request needs. Slow requests need a bigger number.

Check it worked. docker compose config -q prints nothing when the file is valid. If it says variable is not set, .env is not in the same folder.

Tip: The label is read from the old container. A hook you add to a service that is already running only works on the next rollout, because Docker cannot change labels of a running container (docs). Put it in the first version of the file, as we do, or pass --pre-stop-hook "..." once on the command line, which has priority over the label.

Step 4: Start the service for the first time#

Use a plain docker compose up -d --wait the first time. docker rollout would just start the service without waiting for health (issue 38, open).

Linux#

Run in terminalbash
cd ~/docker_volumes/docker-rollout
docker compose up -d --wait
docker compose ps

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\docker-rollout"
docker compose up -d --wait
docker compose ps

Mac (Terminal)#

Same commands as Linux.

Check it worked. docker compose ps shows one container, docker-rollout-web-1, status healthy. Then:

Run in terminalbash
curl -sI https://app.example.com | head -n 3

Use your own name. Expected: HTTP/2 200 and server: nginx/1.29.3 (not run by us).

Step 5: Roll out a new version#

Edit the version in .env, pull the image, then run the plugin instead of docker compose up -d. A second terminal watches the site so you see that nothing drops.

Linux#

Terminal 1, the watcher (stop it later with Ctrl+C):

Run in terminalbash
while true; do curl -s -o /dev/null -w "%{http_code} " https://app.example.com; sleep 0.2; done

Terminal 2, the update:

Run in terminalbash
cd ~/docker_volumes/docker-rollout
sed -i 's/^APP_TAG=.*/APP_TAG=1.30.8-alpine/' .env
docker compose pull web
docker rollout --timeout 60 --wait-after-healthy 5 web

Windows (PowerShell)#

Window 1, the watcher:

Run in terminalpowershell
while ($true) { try { (Invoke-WebRequest -UseBasicParsing https://app.example.com).StatusCode } catch { "ERR" }; Start-Sleep -Milliseconds 200 }

Window 2, the update:

Codepowershell
Set-Location "$HOME\docker_volumes\docker-rollout"
(Get-Content .env) -replace '^APP_TAG=.*', 'APP_TAG=1.30.8-alpine' | Set-Content -Encoding ascii .env
docker compose pull web
wsl docker rollout --timeout 60 --wait-after-healthy 5 web

wsl starts in the same folder (/mnt/c/... from Linux). Not run by us.

Mac (Terminal)#

Same as Linux, except sed needs an empty suffix: sed -i '' 's/^APP_TAG=.*/APP_TAG=1.30.8-alpine/' .env.

nginx:1.30.8-alpine exists on Docker Hub (checked 3 December 2026). A newer tag of your own app works the same way.

Expected output, derived from the script (Compose's own progress lines are left out):

Codetext
==> Scaling 'web' to '2' instances
==> Waiting for new containers to be healthy (timeout: 60 seconds)
==> Waiting for healthy containers to settle down (5 seconds)
==> Running pre-stop hook: touch /tmp/drain && sleep 15
==> Stopping and removing old containers

Check it worked. The watcher printed only 200 the whole time. docker compose ps shows one container, now named docker-rollout-web-2 (each rollout raises the number), and curl -sI https://app.example.com shows server: nginx/1.30.8.

The options we used (all from the v0.14 script and docs):

OptionMeaningDefault
-t, --timeout NSeconds to wait for the new containers to become healthy60
-w, --wait NSeconds to wait when the service has no healthcheck10
--wait-after-healthy NExtra seconds after healthy, so the proxy registers the new containers0 in v0.14
--pre-stop-hook CMDCommand run inside every old container before stopping itnone (or the label)
-f, --file, --env-file, -p, --profilePassed on to Compose, repeatable where Compose allows itnone

Tip: Set --wait-after-healthy yourself. v0.14 uses 0; the README on main says 3 because a later, unreleased change raised it.

Step 6: Break it on purpose (failed healthcheck)#

Test the safety net before you need it. We point the health path at a file that does not exist, so the new container's check fails.

Linux#

Run in terminalbash
cd ~/docker_volumes/docker-rollout
sed -i 's/^HEALTH_PATH=.*/HEALTH_PATH=does-not-exist.html/' .env
docker rollout --timeout 20 web; echo "exit code: $?"
docker compose ps

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\docker-rollout"
(Get-Content .env) -replace '^HEALTH_PATH=.*', 'HEALTH_PATH=does-not-exist.html' | Set-Content -Encoding ascii .env
wsl docker rollout --timeout 20 web; "exit code: $LASTEXITCODE"
docker compose ps

Mac (Terminal)#

Same as Linux, with sed -i '' as in Step 5.

From the v0.14 source, the script waits up to the timeout for every new container to be healthy; on failure it prints their health data and logs, then ==> New containers are not healthy. Rolling back. to the error output, stops and removes the new containers and exits with code 1. The old container is never touched.

Check it worked. The watcher still prints only 200, the exit code is 1, and docker compose ps shows only the old container. "Rolling back" means the new containers are thrown away; it does not undo a database change or an edited .env. Now set HEALTH_PATH=index.html again.

Tip: If your container exits at once instead of failing its healthcheck, v0.14 can remove the healthy old one (issue 75, open, fix proposed). Run docker compose ps after every rollout and rehearse new images on a test copy.

Put it behind HTTPS (with or without Traefik)#

Pick one route; home-only users take the Caddy route with tls internal.

With Traefik#

This is the route upstream documents, and the labels in Step 3 are the whole configuration: router rollout-demo on entrypoints=https, tls.certresolver=le, container port 80. If the proxy network is missing, create it once with docker network create proxy.

Why it works: Traefik's Docker provider (v3.8.0 source, config.go) skips containers whose Docker health is not healthy. The new container gets traffic only when healthy, and the old one loses it as soon as the drain file makes it unhealthy.

Run in terminalbash
curl -I https://app.example.com

Expected: HTTP/2 200 with a valid certificate (not run by us).

Without Traefik: Caddy#

Upstream documents only Traefik and nginx-proxy. A Caddy example is a request in issue 52, still open, so this is our own composition from the Caddy docs: untested, not an upstream recipe. For a full Caddy setup and trusting its root see our Caddy guide; a labels-driven variant is our caddy-docker-proxy guide.

Caddy does not read Docker's health. Instead it asks Docker's DNS for every container named web and retries when one refuses a connection. Save as Caddyfile, next to a Caddy container on the proxy network that publishes 80 and 443:

File contenttext
app.example.com {
	reverse_proxy {
		dynamic a web 80 {
			refresh 2s
		}
		lb_try_duration 5s
	}
}

With a public domain Caddy gets a Let's Encrypt certificate by itself (ports 80 and 443 must reach it). At home use a private name and add tls internal inside the block; then trust Caddy's root on your devices as our Caddy guide shows.

The limit: the Caddy docs say active health checks do not run for dynamic upstreams, so a container that listens but is not ready may get requests, and the drain file means nothing to Caddy. The retry only covers refused connections (app starting, or old container gone) for up to 5 seconds. Test with the watcher from Step 5 before you trust it.

Run in terminalbash
curl -I https://app.example.com

Security and testing#

ControlHow
The script is code that runs as youRead it once, pin the tag, check the SHA-256. Never pipe a moving branch into sh
Docker socketTraefik needs it and it is root-level power; the upstream docs warn and point to a socket proxy (our Traefik and docker-socket-proxy guides)
SecretsIn .env with chmod 600, never in compose.yaml or Git
PortsOnly the proxy publishes 80 and 443
Run in terminalbash
docker compose ps
docker compose logs --tail=50 web
docker inspect --format '{{json .State.Health.Status}}' <container-name>
curl -I https://app.example.com

Common mistakes#

MistakeWhy it happensDo this instead
unknown flag: --quiet (issue 29, 59)An old docker-compose v1 was found; the reporter fixed it with sudo apt install docker-compose-v2Run docker compose version; use Compose v2
container_name: on the serviceCompose source: The "web" service is using the custom container name "web". Docker requires each container to have a unique name. Remove the custom name to scale the serviceDelete container_name
ports: "8080:80" on the serviceTwo containers cannot bind one host port (Docker says port is already allocated)Publish ports on the proxy only
A plain nginx or Caddy with a fixed upstreamNo discovery. Issue 30 needed manual reloads; issue 14: connect() failed (111: Connection refused) while connecting to upstreamTraefik or nginx-proxy, or the Caddy route above, tested
No healthcheckThe script only prints Waiting for new containers to be ready (10 seconds); in issue 32 half the requests still hit the old containerAdd a healthcheck and the drain file
Using docker rollout for the first startIt starts the service and does not wait (issue 38)docker compose up -d --wait first
restart: always, or Ctrl+C mid-rolloutExtra containers stay (issue 25); the maintainer said interrupted runs are not supportedunless-stopped; never interrupt
A slow app rolls back although it would get healthyIssue 61: the 60 second timeout is shorter than the start-up. The maintainer's advice: a larger -tRaise --timeout above start_period plus a few intervals
AI assistants: a service with container_name and ports, then "run docker rollout web"Looks like ordinary ComposeRemove both
AI assistants: invented flags (--strategy) or no service nameThe script prints Unknown option: --strategy or SERVICE is missingRead docker rollout --help
AI assistants: "runs natively in PowerShell"It is an sh scriptUse WSL (Step 1)

Tip: A changed healthcheck or hook label only applies to containers created afterwards. The old container keeps its old ones until it is replaced.

Tip: Do not roll out the proxy itself: it owns ports 80 and 443 and cannot run twice. Update Traefik with docker compose up -d in a quiet moment.

Troubleshooting#

ProblemSolution
docker: 'rollout' is not a docker commandThe file is not in ~/.docker/cli-plugins, not executable, or you are on Windows without WSL. Run ls -l ~/.docker/cli-plugins
docker compose or docker-compose is requiredNeither Compose was found. Install the Compose v2 plugin
Rollout ends with Rolling back.Read the printed health data and logs; docker compose logs --tail=100 web
Visitors see 404 or 502 for a momentAdd a healthcheck and --wait-after-healthy; test with the watcher
Two web containers remain after an aborted rundocker rm -f <older-container>, then docker compose ps
Labels or variables seem ignoreddocker compose config shows what Compose used (do not share it)

Exact error texts#

  • SERVICE is missing: no service name given (script, v0.14).
  • ==> Service 'web' is not running. Starting the service.: nothing existed, so this is a plain start, not a rollout.

Known bugs (open, December 2026)#

Issue 75 (new container exits at once, healthy old one removed; pull request 77 proposes a fix), 38 (no health wait on the first start), 49 and 58 (whole stack or one-by-one rollouts), 52 (no Caddy example). Nothing we found stops a normal install.

Updates and backups#

The plugin. The docs say all versions are backward compatible. Read the release notes, change v0.14 in the URL to the new tag, download again, chmod +x, run docker rollout --version.

Your apps. Change the tag in .env, docker compose pull web, docker rollout web. Database changes must work with both versions (add columns first, remove them a release later). To hear about new images see our Diun and dockcheck guides.

What to back up. compose.yaml and .env (the plugin keeps no state) plus your real app's data; the demo has none. See our docker-volume-backup guide.

Linux and Mac#

Save as ~/docker_volumes/docker-rollout/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/docker-rollout"
out="$base/backups/docker-rollout-$(date +%F).tar.gz"
tar -czf "$out" -C "$base" .env compose.yaml
chmod 600 "$out"

Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):

File contenttext
0 3 * * * /home/<your-user>/docker_volumes/docker-rollout/backup.sh

Windows (PowerShell)#

Save as $HOME\docker_volumes\docker-rollout\backup.ps1:

Codepowershell
$base = "$HOME\docker_volumes\docker-rollout"
$out = "$base\backups\docker-rollout-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base .env compose.yaml

In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> daily at 03:00.

Restore test#

Run in terminalbash
mkdir restore-test && tar -xzf <archive>.tar.gz -C restore-test
cd restore-test && docker compose config -q && echo OK

OK means the files are valid. The full test is docker compose up -d --wait on a spare machine.

Performance and resources#

We measured nothing. What matters: during a rollout your service runs twice (twice the replicas if you run several), so the host needs room for both. Watch it with docker stats while you test. A rollout takes roughly the start-up time, plus --wait-after-healthy, plus the pre-stop sleep (15 seconds here); never shorten the sleep below your slowest request.

Alternatives: Docker Swarm has rolling updates with rollback settings but needs a swarm; Kamal brings its own proxy. Our Dokku, CapRover and Dokploy guides cover full platforms. docker rollout is the smallest option, for people who already like Compose.

FAQ#

Does it work without Traefik? Only with a proxy that finds containers by itself: upstream documents Traefik and nginx-proxy (our nginx-proxy guide). Our Caddy route is untested.

Is it really zero downtime? For stateless apps with a good healthcheck and the drain setup, the gap should be gone. Long connections and database changes are not protected.

Can I update several services at once? One service per command; requests for whole-stack rollouts are open (issue 49).

Does it need Compose v2? Use v2. The docs say v1 also works, but our issues 29, 31 and 59 are v1 trouble, and issue 76 asks to drop v1.

How do I go back to the old version? Set the old tag in .env and run docker rollout web again.

Sources#

Checked against the official docs on 2026-12-03. Nothing was run on a real machine by DIY Lab Hub; the commands and "expected" outputs come from the docs, the source and the issues above.

Try one of these