If you have a Docker app that runs perfectly with docker compose up on your laptop, you have already done the hard part of cloud deployment. The container is portable. What is not portable is everything around it: the database that lives in a volume on your disk, the uploads folder, the .env file, and the implicit assumption that your laptop never runs out of disk or reboots at 3 AM.
Most "cloud deployment" guides treat this as a checklist of vendor features. That is the wrong starting point. The useful question is: when this setup fails, how does it fail, and who has to fix it? And a close second: what will the bill look like in a bad month?
This guide walks through the main cloud deployment models for Docker apps, how each one tends to break and bill, what to ask a provider before committing, and how to move a local compose stack to production without trading one kind of outage for another.
The four cloud deployment models for a Docker app
"Cloud deployment services" covers very different things. For a containerized app, you are realistically choosing between four models.
1. A VPS you manage (IaaS)
You rent a virtual machine, install Docker, copy your compose.yaml, and run it. You own the OS, the reverse proxy, TLS, the database, backups, monitoring, and restarts.
- Fails like: disk fills up, Postgres crashes, a kernel update reboots the box and something does not come back, Certbot renewal breaks silently.
- Bills like: a flat monthly price. Predictable in dollars, unpredictable in hours of your time.
2. Managed Kubernetes
A cloud provider runs the Kubernetes control plane; you define deployments, services, ingress, and storage in YAML (or Helm).
- Fails like: misconfigured resource limits, ingress or certificate issues, persistent volume problems, upgrades that deprecate APIs you depend on.
- Bills like: nodes plus load balancers plus storage plus egress, often across several line items. Powerful, but rarely the right tool for a team of one.
3. Serverless containers
You hand over an image; the platform runs it on demand and scales to zero when idle.
- Fails like: cold starts on the first request after idle, request timeouts on long jobs, surprises with background work that expects a long-running process.
- Bills like: per request or per second of CPU and memory. Very cheap at low traffic, harder to predict under spikes.
4. Application platforms (PaaS)
You connect a Git repo or point at a Docker image; the platform builds, deploys, routes, and scales. Most also offer managed databases and storage.
- Fails like: mostly your application's own bugs. Infrastructure failures become the provider's incident, not yours.
- Bills like: it depends heavily on the provider. Some are flat per instance, some are purely usage-based, some combine a plan fee with included credits.
For a solo founder with a Dockerized MVP, the realistic shortlist is usually a VPS or a PaaS. Kubernetes is overkill at this stage, and serverless containers work well only if your app is purely request/response.
The outage anatomy nobody puts on the pricing page
Here is a pattern worth recognizing. A founder self-hosts on a VPS. It works for months. Then Postgres stops accepting writes because WAL files and container logs filled the disk, and the site is down for six hours overnight. They move to a platform to escape ops work, and the next month a memory-hungry background job or traffic spike produces a bill several times larger than expected.
Two different failures, one root cause: the deployment model's failure mode was not understood before choosing it.
A VPS fails operationally. Usage-based platforms can fail financially. The good news is that both are predictable once you know where to look.
Questions to ask any cloud deployment service
Before you commit, get concrete answers to these:
Reliability
- If my container crashes, is it restarted automatically? How fast?
- Does a deploy wait for a health check before switching traffic, or does it cut over immediately?
- Can I roll back to the previous version in one step?
- For the managed database: how are backups taken, how long are they retained, and have I tested a restore?
- What happens when the database disk approaches full? Alert, auto-grow, or outage?
Billing
- Can I state the monthly cost before deploying, for my expected usage?
- What is metered: CPU, RAM, requests, egress, build minutes, storage?
- What happens in a spike: do I pay more automatically, get throttled, or hit a cap?
- Are there spend limits or alerts, and are they on by default?
- Do the app, database, and storage bill on one invoice, or three vendors?
Operations
- Can a non-engineer co-founder see status, restart an app, or roll back a deploy without shell access?
- Where do I read logs, and how long are they kept?
- Do I need to learn a platform-specific config format, or does my Dockerfile work as is?
If a provider cannot answer the billing questions without a calculator and a free trial, treat that as information.
Preparing a compose stack for any cloud
Whichever service you pick, the local stack needs a few changes. Here is a typical compose.yaml for an MVP:
services:
app:
build: .
ports:
- "3000:3000"
env_file: .env
volumes:
- ./uploads:/app/uploads
depends_on:
- db
worker:
build: .
command: ["node", "dist/worker.js"]
env_file: .env
depends_on:
- db
db:
image: postgres:17
environment:
POSTGRES_PASSWORD: postgres
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:Each piece maps to something different in production:
| Local | Production equivalent | Why |
|---|---|---|
app service | Web service from the same image | Scaled and restarted by the platform |
worker service | Separate background service, same image, different command | Scales independently of web traffic |
db service + pgdata volume | Managed Postgres | Backups, disk, and upgrades are not your job |
./uploads bind mount | S3-compatible object storage | Local disk is not shared or durable across instances |
.env file | Environment variables set in the platform | Secrets stay out of the image and repo |
depends_on | Retry logic in the app | In the cloud, the DB may be briefly unavailable; the app should not crash-loop |
The last row catches people. depends_on only controls start order on one machine. In production, your app must tolerate the database being unreachable for a few seconds, for example during a failover or maintenance window.
Four changes that prevent most container outages
1. A real health check
A platform can only protect you from a bad deploy if it can tell the new version is broken. Add an endpoint that checks your critical dependencies:
app.get("/healthz", async (req, res) => {
try {
await db.query("SELECT 1");
res.status(200).json({ status: "ok" });
} catch (err) {
res.status(503).json({ status: "db_unavailable" });
}
});Keep it cheap. It gets called often, so it should not run expensive queries or call third-party APIs.
2. Graceful shutdown
During every deploy and every scale-down, the platform sends SIGTERM to your container and waits a short time before killing it. If your app ignores the signal, in-flight requests are dropped and background jobs are cut off halfway.
const server = app.listen(process.env.PORT ?? 3000, "0.0.0.0");
process.on("SIGTERM", () => {
console.log("SIGTERM received, draining connections");
server.close(async () => {
await db.end();
process.exit(0);
});
// Force exit if draining takes too long
setTimeout(() => process.exit(1), 10_000).unref();
});For this to work, your process must actually receive the signal. Use exec-form CMD ["node", "dist/server.js"] in your Dockerfile, not CMD npm start, which wraps your app in a shell or npm process.
3. Memory that fits the container
A container that exceeds its memory limit is killed immediately, with no graceful shutdown. That looks like random restarts under load. Two habits help:
- Know your baseline. Run
docker statslocally under realistic load and note peak memory. - Tell the runtime about the limit. For Node.js, set the heap explicitly to leave headroom, for example
NODE_OPTIONS=--max-old-space-size=384on a 512 MB container. JVM and .NET runtimes read container limits automatically in current versions, but it is still worth checking.
On usage-based platforms, memory is also a billing variable. A leak does not just cause restarts; it can quietly raise your bill.
4. Backward-compatible migrations
When the platform rolls out a new version, old and new containers may run side by side for a short time. A migration that renames or drops a column breaks the old version mid-deploy. Use the expand-and-contract approach:
- Deploy 1: add the new column, write to both.
- Deploy 2: read from the new column.
- Deploy 3: remove the old column.
It feels slow. It is much faster than an outage.
Consolidating vendors: the hidden cost of a "best of breed" stack
A common early setup: app on one platform, Postgres on a second provider, files on a third, a CDN on a fourth. Each is individually good. Together they mean four dashboards, four invoices, four sets of credentials, and cross-provider network latency on every database query.
Worse, when something breaks, you debug across boundaries. Is it the app, the database provider's region, or the network between them?
For an MVP, putting the app, database, and storage with one provider in one region has real advantages:
- Lower latency between app and database
- One place to check when something is wrong
- One bill that you can actually predict
- Fewer credentials to rotate and leak
The trade-off is some lock-in. Keep it manageable by sticking to standard interfaces: a Dockerfile, a Postgres connection string, and the S3 API. All three are portable to almost any provider if you ever need to move.
Running Docker apps on Granite.so
Granite.so is an application platform built around exactly this consolidation. The flow for the compose stack above looks like this:
- Create the web app from your Git repository (it builds on every push using your Dockerfile) or from a Docker image you have already built.
- Create the worker as a second app from the same source, with
node dist/worker.jsas its start command. - Provision a managed Postgres database and set its connection string as
DATABASE_URLon both apps. Thedbservice and its volume disappear from your stack. - Create an S3-compatible storage bucket for uploads and point your app at it. Public files are served through the built-in CDN.
- Move
.envvalues into the dashboard as environment variables. - Let automatic scaling handle spikes rather than sizing a VPS for your worst day.
On billing, plans include monthly usage credits, which makes the number easier to predict than pure pay-as-you-go. The Hobby plan is $9 per month with $15 in usage credits, which covers a typical early-stage app with a small database. Check the current pricing page for limits and higher tiers, and compare it honestly against your expected usage before you move.
A managed platform does not make your app bug-free. It moves infrastructure failures off your plate. You still need health checks, graceful shutdown, and safe migrations; those are what let the platform do its job.
A rollout plan for your first beta users
Moving from local to production does not have to be a big-bang event:
- Week 1: apply the four changes above (health check, graceful shutdown, memory settings, migration discipline) and test locally.
- Week 1: create a staging environment on your chosen platform. Deploy, run migrations, click through the main flows.
- Week 2: load a copy of realistic data, test a database restore, and upload files to object storage from the app.
- Week 2: set up error tracking and uptime monitoring against
/healthz. - Week 3: create production, deploy the same image, point DNS, and invite the first handful of beta users.
- Every week after: check the bill against your estimate. If it drifts, find out why while the numbers are small.
The short version
Cloud deployment for a Docker app is less about picking the "best" provider and more about picking the failure mode you can live with. A VPS gives you low flat costs and all the operational risk. Usage-based platforms remove the ops work but can surprise you on the invoice. Kubernetes is a lot of machinery for a team of one.
For most solo founders shipping a first SaaS, a platform that runs your existing Dockerfile, bundles the database and storage, and prices in a way you can predict upfront is the pragmatic middle. If that sounds like what you need, deploy your compose stack to Granite.so and spend the next six weeks on the product instead of the servers.