1. Why Docker Fixes Setup Pain
4 min
The setup problem
You build a web app on your laptop. It runs because your machine has the right Node, Python, Java, database client, environment variables, and port settings.
Then your teammate clones it in hostel Wi-Fi before a hackathon demo. It fails. Their laptop has a different version, missing package, or no database running.
One idea
Docker makes your app’s running setup explicit. Instead of saying “install some things and try npm start”, you describe the OS-level environment, dependencies, ports, variables, storage, and start command.
What Docker adds
A Dockerfile is a text file with commands used to assemble an image. The image is the packaged version of your app setup.
A container is a running copy of that image. If the image is built the same way, the app has a much better chance of running the same way on another laptop.
Plain project story
Without Docker, your README may depend on hidden local setup. With Docker, the important setup starts moving into files that a reviewer can run.
You will write the real Dockerfile in the next lesson. For now, notice the shape: choose a base, set a folder, copy code, install dependencies, start the app.
FROM node:22-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "./src/index.js"]Where Compose fits
Most useful web apps need more than one process. For example, your app plus Postgres. Docker Compose is used to run these services together from one Compose file.