CompTIA

XK0-006 practice question 1

CompTIA Linux+ · free question 1 of 20

Question

A Linux administrator needs to create and then connect to the app-01-image container. Which of the following commands accomplishes this task?
  • A. docker run -it app-01-image Correct
  • B. docker start -td app-01-image
  • C. docker build -ic app-01-image
  • D. docker exec -dc app-01-image

Explanation

docker run creates a new container from the image and starts it, and the -i (keep STDIN open) and -t (allocate a pseudo-terminal) options attach an interactive session to it. docker start only starts an existing container, docker build builds an image from a Dockerfile, and docker exec runs a command in a container that is already running, so none of them both create and connect.

Practice the whole free set

Answer all 20 free XK0-006 questions with instant feedback, or unlock all 154 questions with Learn and Exam modes.