XK0-006 docker build Practice Question
A Linux administrator wants to create a Docker image from a Dockerfile. Which TWO of the following commands are needed? (Select TWO).
⚠ Common exam trap
Candidates often assume only `docker build` is needed, but the question asks for the commands to 'create a Docker image' in a practical sense, which includes tagging for identification.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
docker tag
To create a Docker image from a Dockerfile, two commands are typically used: `docker build` to build the image from the Dockerfile, and `docker tag` to assign a meaningful name and tag to the newly created image. While `docker build` alone creates the image, tagging is necessary for easy identification and management, especially when preparing to push to a registry. Therefore, both commands are needed to fully create a usable Docker image.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
docker run
Why it's wrong here
docker run starts a container from an existing image; it does not create an image.
- ✗
docker push
Why it's wrong here
docker push uploads an image to a registry; it does not create an image.
- ✓
docker tag
Why this is correct
docker tag assigns a name and tag to an existing image, which is commonly done after building to make the image identifiable. This is necessary to fully create a usable image.
- ✓
docker build
Why this is correct
docker build reads a Dockerfile and creates a Docker image; it is the primary command for image creation.
- ✗
docker commit
Why it's wrong here
docker commit creates a new image from a container's changes, not from a Dockerfile.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
Key term
Registry
The Windows Registry is a central hierarchical database that stores configuration settings and options for the operating system, hardware, software, and user preferences.
About these practice questions
Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.