Objective 3.2XK0-005

3.2 Given a scenario, perform basic container operations.

Objective 3.2 sits in Scripting, Containers, and Automation, which carries 19% of the Linux+ exam. The questions below are original, written from the official objective title above, and each explanation cites the CompTIA page it rests on.

Objective title verbatim from the official objectives. CompTIA exam page

A worked example

Shown solved, with the whole explanation open: this is what every question here carries.

3-2Scripting, Containers, and AutomationModerate

An administrator starts an nginx container that must keep running in the background and return the shell prompt at once. Which docker run flag does that?

--rm--rm removes the container after it exits and does not control foreground versus background.
-it-it attaches an interactive terminal, the opposite of running detached.
-dCorrect · your answerCorrect: -d detaches the process so the shell is freed at once.
-p 80-p publishes a port to the host, unrelated to backgrounding the container.

Correct.

Concept

A container can run attached to the terminal or in the background, and a run flag selects which, freeing the shell for other work.

Why C

-d (--detach) runs the container in the background and prints its ID, returning the prompt immediately.

#containers#docker-run#detach

Now you: objective 3.2 questions

No account needed. The explanation opens when you answer.

Sample question 1 of 3

3-2Scripting, Containers, and AutomationHard

An administrator finds a running app unreachable although its Dockerfile declares EXPOSE 8080. What is actually required to reach it from the host?

Sample question 2 of 3

3-2Scripting, Containers, and AutomationModerate

An administrator sees a database container lose all its data whenever it is recreated. Which docker run option keeps the data on the host across restarts?

Sample question 3 of 3

3-2Scripting, Containers, and AutomationEasy

Which docker run flag automatically removes a container and its anonymous volumes when it exits?

Full Linux+ question bank coming

We’re writing the complete bank from the official objectives right now. Leave your email and we’ll tell you when it ships, nothing else, ever.

Read the sources

These are the official pages the questions above cite. Reading them is studying the objective from the primary source, which is what the explanations point you toward anyway.

More objectives in Scripting, Containers, and Automation