A systems administrator needs to find the specific IP address assigned to a running Podman container named webapp01. The administrator wants a single command that will output only the IP address and no other information. Which of the following commands achieves this?
The correct command is podman inspect --format '{{.NetworkSettings.IPAddress}}' webapp01. The podman inspect command is used to display detailed, low-level information about Podman objects. The --format or -f flag allows for formatting the output using Go template syntax. In this case, '{{.NetworkSettings.IPAddress}}' is a Go template that specifically extracts the IPAddress field from the NetworkSettings section of the JSON output produced by the inspect command.
The podman logs command is incorrect because it is used to retrieve the logs from a container's standard output and error streams, not its configuration metadata. The podman ps command is incorrect as it lists a summary of running containers, such as container ID, image, and status, but it does not show detailed network information like the IP address. The podman exec webapp01 ip addr command is incorrect because, while it might display the IP address, it does so by running a command inside the container. This is less direct, produces more output than just the IP address, and relies on the ip utility being present within the container's image.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the role of the '--format' flag in the 'podman inspect' command?
Open an interactive chat with Bash
What is the purpose of the 'NetworkSettings.IPAddress' field in Podman?
Open an interactive chat with Bash
How does 'podman exec' differ from 'podman inspect' when retrieving a container's IP address?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access