Why Containers

Why BookNest Needs Containers, Not Just a VM

To run BookNest, a machine needs Node.js 24 2,131 (package.json says "node": ">=24"), the exact express and pg versions from package-lock.json, a PostgreSQL 18 1,289 server with a booknest user and database, and six environment variables that point the API at it. Redeploying by hand means installing Node.js and PostgreSQL in the right versions, creating the database, copying the source, running npm 2,036 ci and starting both processes. Every step can drift: the server's package manager offers an older PostgreSQL, a colleague still has Node 22, someone forgets a variable.

A virtual machine image with Ubuntu 225 , Node 24 and PostgreSQL 18 inside fixes the drift, but the unit you ship is now a whole operating system, usually several gigabytes, which must be booted, patched and monitored like any server. A container image ships only the application and its user-space dependencies: on this machine postgres:18 takes 650 MB of disk and alpine:3 only 13 MB. With images, the checklist collapses into docker compose up, which pulls the API and database images, puts them on a private network, sets their variables and starts both, identically on a laptop, a CI runner or a server. Containers complement VMs rather than replace them: a cloud server is usually a VM with Docker 514 inside it.