Back to ThoughtsDEVOPS

Zero-Downtime Deployments with Docker and GitHub Actions

March 15, 2026·10 min read

Deploying shouldn't be scary. If your team hesitates before hitting the deploy button, your deployment pipeline has a trust problem. Blue-green deployments solve this by making every deploy reversible.

The core idea

Instead of updating your running application in place, you spin up a completely new instance alongside the old one. Once the new instance is healthy, you switch traffic over. If anything goes wrong, you switch back. The old version is still running — nothing was destroyed.

Setting it up with Docker

yaml
services:
  app-blue:
    image: myapp:${BLUE_TAG}
    ports:
      - "3001:3000"
  app-green:
    image: myapp:${GREEN_TAG}
    ports:
      - "3002:3000"
  nginx:
    image: nginx:alpine
    ports:
      - "80:80"

The key insight is that both versions run simultaneously behind a reverse proxy. The proxy configuration determines which version receives traffic. Switching is just a config reload — no containers need to restart.

GitHub Actions integration

Wire it into your CI/CD pipeline so that every push to main triggers a build, health check, and traffic switch. If the health check fails, the pipeline stops and the old version keeps serving.

The best deployment is the one nobody notices. If your users can't tell you just shipped, you're doing it right.

Start with a single service and expand from there. The pattern scales cleanly to microservices, and the mental model stays the same regardless of complexity.

TaggedTypeScripttRPCZodAPI Design