LOGBOOK

HELP

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 recipe and a pulled base image feed docker build, which produces your own runnable 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 from
  • COPY - copy files into the image
  • RUN - execute commands during build
  • CMD - command to run when container starts

Build the image:

$ docker build -t myapp:latest .

Go deeper:

From Quiz: WEBT / Advanced Topics | Updated: Jul 31, 2026