ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 24 - XK0-005 discussion

Report
Export

A Linux administrator needs to analyze a failing application that is running inside a container. Which of the following commands allows the Linux administrator to enter the running container and analyze the logs that are stored inside?

A.
docker run -ti app /bin/sh
Answers
A.
docker run -ti app /bin/sh
B.
podman exec -ti app /bin/sh
Answers
B.
podman exec -ti app /bin/sh
C.
podman run -d app /bin/bash
Answers
C.
podman run -d app /bin/bash
D.
docker exec -d app /bin/bash
Answers
D.
docker exec -d app /bin/bash
Suggested answer: B

Explanation:

Podman exec -ti app /bin/sh allows the Linux administrator to enter the running container and analyze the logs that are stored inside. This command uses the podman tool, which is a daemonless container engine that can run and manage containers on Linux systems. The exec option executes a command inside an existing container, in this case app, which is the name of the container that runs the failing application. The -ti option allocates a pseudo-TTY and keeps STDIN open, allowing for interactive shell access to the container. The /bin/sh argument specifies the shell command to run inside the container, which can be used to view and manipulate the log files.

The other options are not correct commands for entering a running container and analyzing the logs.

Docker run -ti app /bin/sh creates a new container from the app image and runs the /bin/sh command inside it, but does not enter the existing container that runs the failing application.

Podman run -d app /bin/bash also creates a new container from the app image and runs the /bin/bash command inside it, but does so in detached mode, meaning that it runs in the background without interactive shell access. Docker exec -d app /bin/bash executes the /bin/bash command inside the existing app container, but also does so in detached mode, without interactive shell access.

Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks; View container logs | Docker Docs; How to see the logs of a docker container - Stack Overflow

asked 02/10/2024
Oleksii Derevianchenko
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first