nerdexam
Docker

DCA · Question #20

Which set of commands can identify the publishd port(s) for a container? (Choose 1.)

The correct answer is B. 'docker container inspect', docker port'. The docker container inspect command provides detailed information about a container, including its published ports, and docker port specifically lists the port mappings for a running container.

Submitted by carlos_mx· Apr 18, 2026Networking

Question

Which set of commands can identify the publishd port(s) for a container? (Choose 1.)

Options

  • A'docker port inspect', 'docker container inspect'
  • B'docker container inspect', docker port'
  • C'docker info','docker network inspect'
  • D'docker network inspect','docker port'

How the community answered

(50 responses)
  • A
    2% (1)
  • B
    90% (45)
  • C
    2% (1)
  • D
    6% (3)

Why each option

The `docker container inspect` command provides detailed information about a container, including its published ports, and `docker port` specifically lists the port mappings for a running container.

A'docker port inspect', 'docker container inspect'

`docker port inspect` is not a valid Docker command; the correct command is `docker port`.

B'docker container inspect', docker port'Correct

`docker container inspect <container_id_or_name>` displays comprehensive details about a container, including its network settings and published ports under `NetworkSettings.Ports`. `docker port <container_id_or_name>` directly outputs the public-private port mappings for a given container concisely.

C'docker info','docker network inspect'

`docker info` provides system-wide Docker information, and `docker network inspect` provides details about a Docker network, neither of which directly list published ports for a *specific container*.

D'docker network inspect','docker port'

`docker network inspect` details a network, not container ports, making this combination incorrect for identifying published container ports.

Concept tested: Identifying Docker container port mappings

Source: https://docs.docker.com/engine/reference/commandline/container_inspect/

Topics

#Docker CLI#Port Mapping#Container Inspection#Networking

Community Discussion

No community discussion yet for this question.

Full DCA Practice