How a drain file and pre-stop hook finally achieved zero-downtime Docker Compose deploys
A developer running a single-VPS Docker Compose stack with Traefik discovered that deploys were silently dropping requests despite using the docker-rollout tool, which handles container swaps but does not drain the old container before removal. Load testing under constant traffic revealed that Traefik continued routing requests to the old container right up until it was deleted, causing 502 errors on every deploy. The fix involved a marker-file-based healthcheck and a pre-stop hook that signals Traefik to stop sending traffic, then waits long enough for all in-flight requests to complete before the container is removed. After adding connection draining, the same load test recorded zero dropped requests. The developer packaged the full deployment flow — including registry login, migrations, ordered rollout, draining, and automatic rollback — into an open-source GitHub Action called docker-rollout-action.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in