ssam//commerce
Writing
2026-10-12InfrastructureDockerPractice

One server, many clients: isolating stacks with Docker

The compose-project pattern I use to host multiple client systems on a single server without letting them touch each other — and the discipline that makes upgrades boring.

Here is the pattern I use, and the discipline behind it.

One compose project per system

Every client system — storefront, API, database, proxy, backups — lives in its own Compose project directory with its own compose.yaml. No shared networks, no shared volumes, no shared environment files.

name: client-stack
services:
  web:
    build: .
    restart: unless-stopped
    ports:
      - "3001:3000"
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
  proxy:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"

volumes:
  db-data:

The rule that matters: if container A can reach container B, you had a reason, and you can name it. Everything else stays behind its own network boundary.

What isolation actually buys

Blast radius. A bad deploy, a memory leak, or a Postgres upgrade gone sideways affects one stack. The other clients never notice.

Independence. Each stack upgrades its own runtime on its own schedule. One client's Node version is never held hostage by another's.

Readable failure. docker compose -p <project> ps tells you exactly which system is unhealthy. No archaeology across shared containers.

The parts people skip

A port budget. Host ports are allocated deliberately and written down. When a new stack needs a port, the map — not memory — decides.

Backups as a container, restores as a ritual. Backups run inside the stack on their own schedule. A backup that has never been restored is a hope, not a strategy — so restores get rehearsed.

TLS per stack. Certificates renew automatically inside the stack. Certificate expiry is an outage category that should not exist in 2026.

When to stop

One server, many stacks is the right answer up to a point. When a client's traffic or compliance needs start to argue for dedicated hardware, that argument should be easy to make — because every stack already behaves as if it owned the machine.

Isolation is what makes density cheap. Without it, density is just shared risk with better margins.

// Engage

Have a system to build, improve, or rescue?

Tell me what you're working on. I read everything myself and reply to serious inquiries.