Decision in brief
Build and tag an image once in CI, then promote that immutable artifact. Use Docker Compose when a single host meets your recovery and availability targets. Keep restore and rollback procedures alongside the Compose definition, and evaluate a multi-host platform when an outage of that host would breach your targets.

Choose a container workflow that fits deployment and recovery
Use a multi-stage Dockerfile when build tools and artifacts can be separated from runtime. Copy dependency manifests before frequently changed source to reuse stable dependency layers. Add a .dockerignore that excludes credentials, local databases and build outputs from the context. Record the base digest in source and update it through a reviewed dependency change. A digest gives reproducibility and requires an update process to keep receiving patches.
Keep runtime configuration in Compose or your deployment platform and persist state in a named volume or a managed service. Compose can wait for a dependency's health check if configured for that condition. Give the application its own readiness check and retry behavior, since a dependency can fail after startup.
| Workload | First approach to try | Check before adoption |
|---|---|---|
| Stateless service with frequent changes | Multi-stage image built in CI and promoted by digest | Time builds after a source-only change and verify the same digest in staging and production promotion. |
| Few services on a replaceable Linux host | Compose, explicit health checks and a documented restore procedure | Prove that a fresh host can serve healthy traffic and recover the required application data. |
| Service with strict host-outage or traffic-interruption targets | Compare a managed or multi-host runtime against the simplest working deployment | Measure endpoint error rate during a deploy and recovery after losing a host. |
| Service with persistent data | Named volume or managed storage and recoverable backups | Restore a representative dataset and verify records before accepting writes. |
What two HN operators put under review
In the smaller-images thread, grim_io reported encountering multi-gigabyte images and teams unfamiliar with multi-stage builds. A useful build comparison records runtime image size, cold pull time and warm build time, with the same application and integration suite.
In the Compose deployment thread, hnlmorg pointed out that the cited workload could run on one host and identified loss of that host as a reason to evaluate a different deployment architecture. Rehearse restart, rollout and whole-host replacement as separate scenarios.
Run a build, rollout and restore rehearsal
Use one staging application with synthetic state. Agree on cold pull time, deploy error budget, maximum recovery time and acceptable data age before comparing changes.
- Build from a clean checkout and then change only application source. Record each build time, image size and digest. Run the same functional tests against both the existing and proposed runtime images.
- Exercise a staged rollout under steady test traffic and record error rate and readiness time. Roll traffic back to the previous digest and confirm it can read the current schema and seeded records.
- Recreate the environment on a disposable host and restore the latest staged backup. Check record counts and application reads, then record elapsed time and data age.
- Promote only if build reproducibility, the deployment error budget and both recovery objectives pass. Pause a migration that makes the previous app or restored data unusable until the rollback procedure covers it.