Which command reveals the port mapping for a container?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which command reveals the port mapping for a container?

Explanation:
Port mappings describe how host ports are bound to container ports, so the most direct way to reveal them is to query those published ports with the port subcommand. Running the port command followed by the container identifier asks Podman to display the host-to-container port bindings exactly as they’re exposed, making it the quickest and clearest method to see what ports are mapped. For example, if a container named myapp exposes 80/tcp and 443/tcp and these are published to host ports 8080 and 8443, the command would show mappings like 0.0.0.0:8080->80/tcp and 0.0.0.0:8443->443/tcp. Other commands aren’t as focused on port mappings: inspecting a container shows broader details, including ports, but it’s more verbose; listing containers won’t show mappings at all; and using an incorrect option with port won’t provide the needed information.

Port mappings describe how host ports are bound to container ports, so the most direct way to reveal them is to query those published ports with the port subcommand. Running the port command followed by the container identifier asks Podman to display the host-to-container port bindings exactly as they’re exposed, making it the quickest and clearest method to see what ports are mapped. For example, if a container named myapp exposes 80/tcp and 443/tcp and these are published to host ports 8080 and 8443, the command would show mappings like 0.0.0.0:8080->80/tcp and 0.0.0.0:8443->443/tcp. Other commands aren’t as focused on port mappings: inspecting a container shows broader details, including ports, but it’s more verbose; listing containers won’t show mappings at all; and using an incorrect option with port won’t provide the needed information.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy