thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

DevOps & Automation · Foundational

Dockerfile

A text file of instructions (FROM, RUN, COPY, CMD, and others) that Docker uses to build a container image.

Definition

Each instruction that changes the filesystem creates a layer. Best practices include pinning base images, ordering instructions to maximize cache hits, using multi-stage builds, running as a non-root USER, and minimizing layers and packages.

Example

FROM python:3.12-slim COPY requirements.txt . RUN pip install -r requirements.txt COPY . . CMD ["python","app.py"]

Exam tip

Copy dependency files and install them before copying source code so code changes do not invalidate the dependency layer cache.

Related terms