liveBook · Manning

From instruction

As explained in Road to Kubernetes

The FROM directive is a Dockerfile instruction that specifies the base container image for a build.

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

How Road to Kubernetes covers it

How deep it goes
Defines inheritance and version tags, but stops short of explaining image internals or advanced Dockerfile behavior.
Examples
Demonstrates Ubuntu with NGINX and versioned Python and Node.js runtime images.
What it assumes
Assumes Dockerfile and container basics while teaching image selection and automatic image pulling through practical examples.
What you can do after
Build it from scratch by selecting a runtime image and writing its FROM line with an appropriate version tag.
How it connects
Connects base images with Dockerfiles, image tags, Docker Hub, RUN, COPY, WORKDIR, and CMD.

Also explained in

Compare how 3 books explain from instruction →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.