Six instructions cover most Dockerfiles
FROM— the base image. Every Dockerfile starts with one.WORKDIR— set the working directory (creates if absent). Use this instead ofcd.COPY— copy files from build context to image.RUN— execute a command at build time (creates a new layer).EXPOSE— document which port the app listens on. Pure metadata.CMD— default command when the container starts.
A complete real Dockerfile
Below is a working FastAPI Dockerfile. It is intentionally simple — no multi-stage yet, no non-root user yet — just the six core instructions in their natural order. Track 2 expands on each.