FROM
The Dockerfile instruction that picks the base image a build starts from.
In more detail
Every Dockerfile starts with FROM (only ARG, comments and parser directives may come before it). FROM python:3.12-alpine means everything in that image is already underneath your first layer. A Dockerfile with several FROM lines is a multi-stage build, and each stage can be given a name that later stages copy from.
Examples
FROM alpine:3.20FROM python:3.12-alpine AS baseFROM gcr.io/distroless/static-debian12FROM eclipse-temurin:21-jdk AS buildRelated terms
- Dockerfile — A text file of instructions, such as FROM, COPY and RUN, that tells Docker how to build an image.
- base image — The image a Dockerfile starts from with FROM, which supplies the operating system files and often a language runtime.
- multi-stage build — A Dockerfile with several FROM stages, where later stages copy only what they need from earlier ones.
- pinning — Fixing an exact version or digest of something you depend on so it cannot change without you noticing.
Taught in
- Building and Pushing Container Images — Continuous Integration & Continuous Delivery Pipelines
- Container Images The Exam Way — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Minimal Base Images: Less To Attack — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Immutable Containers: Read-Only At Runtime — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering
- Union Filesystems, Images And Writable Layers — Docker Architecture & Production Containers
- Run The Spine Service And Publish Its Port — Docker Architecture & Production Containers
- FROM, WORKDIR, COPY And ADD — Docker Architecture & Production Containers
- ARG, ENV, LABEL, EXPOSE And VOLUME — Docker Architecture & Production Containers
- Multi Stage Builds, Targets And Build Secrets — Docker Architecture & Production Containers
- Define The Service And Database With Compose — Docker Architecture & Production Containers
- The Container Registry: Build, Tag, Push, Clean Up — GitLab Certified CI/CD Associate Exam Prep
- Shipping in Scratch and Distroless Images — Concurrent Systems Programming with Go
- Packaging Into A Container — Modern Java: Virtual Threads & High-Throughput Services
- One Command, Six Programs — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Pin It, Lint It, Prove It: Images And Runtimes — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Twelve Lines, Ten Warnings: Dockerfile Instructions And hadolint — Docker Certified Associate (DCA) Exam Prep
- Images Sprint: Eight Questions On Builds, Tags And Registries — Docker Certified Associate (DCA) Exam Prep
- Security Sprint: Eight Questions On Defaults, Trust And Access — Docker Certified Associate (DCA) Exam Prep
- Works On My Laptop: Images, Containers, Volumes And Networks — CompTIA Linux+ (XK0-006) Exam Prep
References
Certification courses
- CKAD course and practice exam: Certified Kubernetes Application Developer
- CKS course and practice exam: Certified Kubernetes Security Specialist
- GitLab CI/CD Associate course and practice exam: GitLab Certified CI/CD Associate
- KCNA course and practice exam: Kubernetes and Cloud Native Associate
- DCA course and practice exam: Docker Certified Associate
- CompTIA Linux+ course and practice exam: XK0-006