Skip to main content

What does the FROM instruction do in a Dockerfile?

Entry Docker
Quick Answer FROM sets the base image รขโ‚ฌโ€ the starting point for your new image. Everything you build on top (RUN, COPY, etc.) layers on top of this base. FROM ubuntu:22.04 starts with Ubuntu; FROM node:20-alpine starts with Node pre-installed on Alpine. Choosing the right base image affects size, security, and compatibility.

Answer

FROM sets the base image for your container, for example FROM node:20-alpine or FROM ubuntu:22.04.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice