Docker appeared in several of the backend and remote adverts we read, often alongside cloud platforms and Kubernetes. It is rarely a hard requirement for a first junior role, which is why this lesson is optional, but understanding containers helps you follow team conversations and makes your projects easier for others to run.
The problem containers solve
"It works on my machine" is a classic developer complaint. Your app runs on your laptop with a certain version of Node.js or Python, certain libraries and certain settings. A teammate or a server has different versions, and things break. A container packages your app together with everything it needs to run, so it behaves the same everywhere.
Images and containers
- An image is the recipe and ingredients: your code, the language runtime, libraries and the command to start.
- A container is a running copy of that image. You can start many containers from one image.
You describe an image in a file called a Dockerfile:
FROM node:22-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
CMD ["node", "server.js"]Line by line: start from a small official Node.js image, work in /app, copy the package files and install dependencies, copy the rest of the code, and set the start command.