A container packages an application with its runtime dependencies into an isolated, reproducible unit, while a multi-container orchestration file such as docker-compose.yml declares how several related containers, such as an API, database, cache, and broker, run and network together.
In simpler words
Docker ships this exact app plus everything it needs as one predictable box. Compose wires several boxes together for local development.
Judge Docker the same conceptual way as Redis or RabbitMQ: where it solves a real environment problem, and where it stops mattering for this course.
Explain what a container isolates versus a virtual machine
Read a docker-compose.yml and name each service role
Reason about why it works on my machine gets fixed by containers
Describe the tradeoff of adding Docker to a small team workflow
Why containers instead of installing locally
Definition
Environment drift occurs when developer machines have different tool, library, or operating system versions than production, producing bugs that only reproduce on some machines. Containers eliminate that drift by shipping the exact runtime.
In simpler words
Docker stops it works on my laptop but not in staging by shipping the whole environment, not only the code.
A container bundles the app, its language runtime, and system libraries into one image that runs identically on a laptop, a CI runner, or a production host.
Compared to a full virtual machine, a container shares the host kernel and starts in seconds, which is why local development stacks combining a database, cache, broker, and API commonly run as containers instead of virtual machines.
This monorepo could run Postgres in a container for local development specifically so every contributor gets the same database version without installing Postgres natively.
Each service is one container. depends_on only orders startup; it does not wait for the database to accept connections.
What Compose does and does not guarantee
Definition
docker-compose.yml declares service definitions, networking, and startup order for local or single-host multi-container environments. It does not manage rolling deploys, autoscaling, or multi-host orchestration.
In simpler words
Compose is great for running a whole stack locally with one command. It is not a production deployment platform by itself.
depends_on controls container start order, not application readiness. Nest must still retry its Postgres connection on boot rather than assume the database is already accepting queries.
Named volumes persist data, such as a Postgres data directory, across container restarts. Without one, stopping the stack can silently wipe local development data.
Production-grade orchestration, such as rolling updates, health-based routing, and scaling, is typically a separate tool such as Kubernetes or a managed container service. Compose is the local development and single-host layer.
Keep in mind
Containers fix environment drift; they do not fix incorrect code.
depends_on is start order, not a readiness check, so code defensively.
Reach for full orchestration only once the single-host model of Compose is not enough.
Test
Check your understanding
At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥ 80% (enforced by the API) to save progress.