Dockerfile Cheat Sheet/Use FROM instruction

Set the base image for a Dockerfile stage.

Section: Dockerfile Basics

Use FROM instruction

dockerfile
dockerfile
FROM node:20-alpine
Explanation

Every stage starts from a `FROM` instruction.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Dockerfile Basics
Use WORKDIR instruction
Set the working directory for subsequent instructions.
OpenIn sheetdockerfilesame section
Copy files into image
Copy files from the build context into the image.
OpenIn sheetdockerfilesame section
Run build step
Execute a command during image build.
OpenIn sheetdockerfilesame section
Set default command
Set the default command when the container starts.
OpenIn sheetdockerfilesame section
Set entrypoint
Set the container entrypoint executable.
OpenIn sheetdockerfilesame section
Document a listening port
Document the port the application listens on.
OpenIn sheetdockerfilesame section