The FROM instruction specifies the prebuilt container image that a Dockerfile inherits. It provides the starting environment for later instructions such as RUN, COPY, and CMD. section 5.2.1
Use FROM as the first step in a repeatable container build:
- Choose an image repository and the required version tag, such as python:3.11.4 or node:18.17.0. section 5.3.1 section 5.4
- Check the official image repository for the exact tag before putting it in the FROM line. section 5.4
- Let Docker pull the image automatically during docker build or docker run when it is not already local. section 5.3.1
- Add installation, application files, and startup behavior with subsequent Dockerfile instructions. section 5.2.1 section 5.4
Ubuntu base image for NGINX
FROM ubuntu RUN apt-get update && apt-get install -y nginx CMD ["nginx", "-g", "daemon off;"] Here, FROM ubuntu supplies the starting image; RUN installs NGINX; and CMD starts it when the container runs. section 5.2.1
Language-specific base images
FROM python:3.11.4 selects a precise Python runtime. FROM node:18.17.0 selects a precise Node.js runtime for an Express.js application, after which application files and dependencies can be added. section 5.3.1 section 5.4


