0
0
Dockerdevops~5 mins

FROM instruction for base image in Docker - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the FROM instruction in a Dockerfile?
The FROM instruction sets the base image for the Docker image you want to build. It tells Docker which existing image to start from.
Click to reveal answer
intermediate
Can a Dockerfile have multiple FROM instructions?
Yes, a Dockerfile can have multiple FROM instructions to create multi-stage builds. Each FROM starts a new stage.
Click to reveal answer
beginner
How do you specify a specific version of a base image in the FROM instruction?
You add a tag after the image name, separated by a colon. For example, FROM ubuntu:22.04 uses Ubuntu version 22.04 as the base image.
Click to reveal answer
beginner
What happens if you omit the tag in the FROM instruction?
If you omit the tag, Docker uses the 'latest' tag by default, which means it uses the most recent version of the image.
Click to reveal answer
intermediate
Why is it important to choose a small base image in the FROM instruction?
Choosing a small base image reduces the final image size, making downloads and deployments faster and saving storage space.
Click to reveal answer
What does the FROM instruction do in a Dockerfile?
ARuns a command inside the container
BSets the base image for the build
CCopies files into the image
DDefines environment variables
How do you specify a version of an image in the FROM instruction?
AFROM image:version
BFROM image@version
CFROM version/image
DFROM image#version
What tag does Docker use if none is specified in FROM?
Astable
Bdefault
Clatest
Dbase
Can a Dockerfile have more than one FROM instruction?
ANo, only one FROM is allowed
BYes, but only if images are the same
CNo, it causes an error
DYes, for multi-stage builds
Why choose a smaller base image in FROM?
AIt reduces image size and speeds up deployment
BIt increases security automatically
CIt is easier to write Dockerfiles
DIt has more features
Explain the role of the FROM instruction in building a Docker image.
Think about how Docker knows what to build on top of.
You got /4 concepts.
    Describe how to specify and why to choose a specific base image version in the FROM instruction.
    Consider why you might not want to always use the latest version.
    You got /5 concepts.