Quiz Entry - updated: 2026.07.31
What is a Dockerfile and how do you create a Docker image?
A Dockerfile is a text recipe of instructions — starting from a base image — that docker build runs to produce a container image.
* A Dockerfile's instructions plus its base image are combined by docker build into your own runnable image. *
FROM node:24.0.2-alpine3.20
COPY src/ ./
RUN npm install
CMD [ "node", "server.js" ]
Key instructions:
FROM- base image to start fromCOPY- copy files into the imageRUN- execute commands during buildCMD- command to run when container starts
Build the image:
$ docker build -t myapp:latest .
Go deeper:
Dockerfile reference (Docker docs) — every instruction (FROM, COPY, RUN, CMD, …) you can put in the recipe.