Repaso
EspaƱol
Cloud & DevOpsCoreOPS-31

What is a Dockerfile?

Options

  1. A log file that records the steps of a build
  2. A text file with step-by-step instructions to build an image (Correct option)
  3. A configuration file for the Docker settings of the computer
  4. A list of the containers that are currently running

Answer

A text file with step-by-step instructions to build a Docker image

Why

A Dockerfile is a recipe: start from a base image, copy files, install dependencies, define the start command. docker build runs it and produces an image.

FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Remember

Dockerfile = recipe for an image.

Key terms

Practice this question in Repaso