nerdexam
DockerDocker

DCA · Question #19

DCA Question #19: Real Exam Question with Answer & Explanation

The correct answer is A: All nodes in the cluster will listen on port 8080 and forward to port 80 in the container.. In Docker Swarm, when a service publishes a port with host_port:container_port, all manager and worker nodes in the cluster listen on the specified host_port and route traffic to the container's container_port.

Submitted by takeshi77· Apr 18, 2026Orchestration

Question

What behavior is expected when a service is created with the following command: 'docker service create --publish 8000:80 nginx'

Options

  • AAll nodes in the cluster will listen on port 8080 and forward to port 80 in the container.
  • BOnly a single node in the cluster will listen on port 8080 and forward to port 80 in the container.
  • CAll nodes in the cluster will listen on port 80 and forward to port 8080 in the container.
  • DOnly a single node in the cluster will listen on port 80 and forward to port 8080 in the container.

Explanation

In Docker Swarm, when a service publishes a port with host_port:container_port, all manager and worker nodes in the cluster listen on the specified host_port and route traffic to the container's container_port.

Common mistakes.

  • B. The Docker Swarm routing mesh ensures that all nodes in the cluster listen on the published port, not just a single node, providing high availability and load balancing.
  • C. The command --publish 8000:80 maps host port 8000 to container port 80, not the other way around.
  • D. This option is incorrect because the mapping is reversed and the routing mesh involves all nodes, not just a single one.

Concept tested. Docker Swarm routing mesh and port publishing

Reference. https://docs.docker.com/engine/swarm/ingress/

Topics

#Docker Swarm#Service Networking#Port Mapping#Routing Mesh

Community Discussion

No community discussion yet for this question.

Full DCA PracticeBrowse All DCA Questions