DELAPARRA
Index
Color
NL
Category: Docker

FROM

Explained by Updated

What is FROM?

FROM: Sets the base image for the build stage. Must be the first instruction (after optional ARGs). Can appear multiple times in a multi-stage build. FROM is the first instruction in a Dockerfile. It sets the base image the build starts from, such as FROM php:8.4-fpm-alpine or FROM node:22-slim. A Dockerfile can contain several FROM lines. Each starts a new stage in a multi-stage build. You might compile assets in a Node stage, install PHP dependencies in a Composer stage, and copy only the finished results into a small final image.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about FROM

What should you keep in mind with FROM?

Multi-stage builds keep production images small and free of build tools, which makes them faster to deploy and gives attackers less to work with. Name your stages with AS, as in FROM node:22 AS assets, so later COPY --from=assets lines are readable. Pin base image versions so builds are repeatable.

What does an example of FROM look like?

FROM python:3.12-slim AS base

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with F

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.