CHAPTER 1 / 8
From development to production
The primary value of containers lies less in the slogan “same everywhere” than in bundling runtime dependencies and the start command into a versioned artifact.
Why this concept became necessary
Libraries present locally but absent on the server, different OS packages, and different environment values can cause deployment failures. Pin dependencies with a build recipe and lockfile, and inject configuration and secrets from outside the image.
Even with the same image, CPU architecture, kernel capabilities, volumes, and external services may differ. Reproducibility requires recording the artifact digest, execution configuration, migrations, and data conditions.
The primary value of containers lies less in the slogan “same everywhere” than in bundling runtime dependencies and the start command into a versioned artifact.
The build packages filesystem layers and metadata into a content-addressed image.
Run the same digest from staging with the production configuration, and compare dependency and health contracts.
Follow it through a concrete system
On a developer laptop, a process shares a network with the local database and test data is small, so timeout, DNS, certificate, and resource-limit problems may not be apparent. In production, multiple instances, load balancers, secret stores, and external services are connected, and partial failures are routine. “It works on my computer” is the starting point of a functional hypothesis, not evidence that it is ready to deploy.
To reduce environment differences, version not only source code but also dependency locks, runtime versions, configuration schemas, and build procedures together. Inject secrets and environment-specific endpoints at deployment rather than embedding them in the image. If they are missing, fail at startup instead of silently defaulting to production. Promoting the same artifact through staging and production, with differences confined to explicit configuration, supports reproduction and rollback.
Selection criteria and failure boundaries
Shared host kernels, image vulnerabilities, secret injection, and stateful data become separate concerns.
Misconceptions to avoid: An image running locally does not guarantee identical production behavior.
Verify it yourself
Run the same digest from staging with the production configuration, and compare dependency and health contracts.
Official sources for this chapter
The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.
- Docker, 「Use Compose in Production」Review date 2026-08-28 · Scope Docker Compose official documentation