0
0
Dockerdevops~20 mins

FROM instruction for base image in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
FROM Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of Docker build with FROM alpine
What will be the base image used and the first line output when building this Dockerfile?
FROM alpine
RUN echo Hello World
Docker
FROM alpine
RUN echo Hello World
A
Base image: alpine
Output: Hello World
B
Base image: ubuntu
Output: Hello World
C
Base image: alpine
Output: RUN echo Hello World
D
Base image: scratch
Output: Hello World
Attempts:
2 left
💡 Hint
The FROM instruction sets the base image for the build.
🧠 Conceptual
intermediate
1:30remaining
Purpose of the FROM instruction
What is the main purpose of the FROM instruction in a Dockerfile?
ATo copy files into the image
BTo specify the base image for the Docker build
CTo run commands inside the container
DTo expose ports from the container
Attempts:
2 left
💡 Hint
Think about what sets the starting point for building an image.
Configuration
advanced
2:30remaining
Using multiple FROM instructions
What happens when a Dockerfile contains multiple FROM instructions?
AOnly the first FROM is used; others are ignored
BThe last FROM overrides all previous ones
CDocker throws a syntax error
DEach FROM starts a new build stage, allowing multi-stage builds
Attempts:
2 left
💡 Hint
Multiple FROM instructions enable building in stages.
Troubleshoot
advanced
2:00remaining
Error when using invalid base image in FROM
What error will Docker show if the base image specified in FROM does not exist?
Amanifest for <image> not found: manifest unknown: manifest unknown
BSyntax error near FROM instruction
CPermission denied while accessing base image
DContainer exited with code 1
Attempts:
2 left
💡 Hint
Docker tries to pull the image and fails if it doesn't exist.
Best Practice
expert
3:00remaining
Choosing a base image for minimal size
Which base image is best to use in the FROM instruction for the smallest possible image size?
Adebian
Bubuntu
Cscratch
Dcentos
Attempts:
2 left
💡 Hint
One base image is completely empty and minimal.