"Works on my machine" — Docker's whole reason to exist is killing that sentence. It packages your app WITH its environment so it runs identically everywhere.
The two words
- Image: the frozen recipe — OS layer + Node + your code + dependencies
- Container: a running instance of an image. One image → many identical containers
A real Dockerfile (Node.js)
FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . EXPOSE 3000 CMD ["node", "index.js"]
docker build -t my-api . docker run -p 3000:3000 my-api
Docker vs virtual machines
VMs virtualize hardware and boot a whole OS (GBs, minutes). Containers share the host kernel and isolate processes (MBs, milliseconds). That efficiency is why one laptop runs 20 containers.
Do freshers need it?
You won't be asked to write Dockerfiles in fresher interviews, but "I containerized my project" on a resume signals production awareness — and deploying to Render/Railway with Docker is genuinely easier.
← All Articles