Courseiva

XK0-006 Automation, Orchestration, and Scripting Practice Question

An administrator needs to create a Docker image from a Dockerfile located in the current directory and tag it as 'myapp:v1'. Which command should be used?

⚠ Common exam trap

XK0-006 often tests the distinction between image creation commands: candidates may confuse `docker build` with `docker create` or `docker commit`, or mistakenly think `docker image create` is valid.

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 build -t myapp:v1 .

The correct command is `docker build -t myapp:v1 .` because `docker build` reads a Dockerfile from the specified context (the `.` means the current directory) and builds an image. The `-t` flag tags the resulting image with the name and tag `myapp:v1`. This is the standard way to create an image from a Dockerfile.

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 create -t myapp:v1 .

    Why it's wrong here

    'docker create' instantiates a stopped container from an existing image; it never reads a Dockerfile or builds layers. It tempts because it accepts -t and a context path, and would be correct when creating a container from an image that already exists.

  • ✗

    docker commit myapp:v1 .

    Why it's wrong here

    'docker commit' snapshots a running container's filesystem into an image, ignoring any Dockerfile. It tempts because it does produce a tagged image, and would be correct after manually modifying a container and wanting to capture those changes as an image.

  • ✓

    docker build -t myapp:v1 .

    Why this is correct

    docker build reads the Dockerfile from the specified context, and the dot sets the current directory as that context. The -t flag assigns the repository and tag myapp:v1, satisfying both the build-from-current-directory and tagging requirements in one command.

  • ✗

    docker image create myapp:v1 .

    Why it's wrong here

    No 'docker image create' subcommand exists; image creation from a Dockerfile is performed by 'docker build', which also applies the -t tag. It tempts as a guess at the modern image-management syntax, and would be right only if such a create subcommand actually existed.

About these practice questions

One of 781 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

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.